@@ -31,28 +31,18 @@ CMAKE_ARCH="${CMAKE_ARCH:-"$ARCH"}"
31
31
cwd=" $PWD "
32
32
repo_root=" $( readlink -f " $( dirname " $0 " ) " /..) "
33
33
34
- image=ghcr.io/appimage/appimageupdate-build
35
- cache_image =" ${image} -cache "
34
+ # use docker image tag provided by GitHub actions if possible
35
+ DOCKER_TAG =" ${DOCKER_TAG :- ghcr.io / appimage / appimageupdate-build : local-build} "
36
36
37
- # push only on default branch
38
- if [[ " ${GITHUB_ACTIONS:- } " ]]; then
39
- echo " Building on GitHub actions, checking if on default branch"
40
- if [[ " refs/heads/${GITHUB_HEAD_REF} " == " ${GITHUB_DEFAULT_BRANCH} " ]]; then
41
- echo " Building on default branch, pushing to cache"
42
- cache_build_args+=(
43
- --cache-to type=" registry,ref=$cache_image "
44
- --push
45
- )
46
- fi
47
- else
48
- echo " Not building on GitHub actions, not publishing cache"
49
- fi
37
+ default_branch_tag=" ${echo " $DOCKER_TAG " | cut -d: -f1): $(echo " $GITHUB_DEFAULT_BRANCH " | rev | cut -d/ -f1 | rev)"
50
38
51
39
# building local image to " cache" installed dependencies for subsequent builds
52
40
docker build \
53
- --cache-from " type=registry,ref=$cache_image " \
41
+ --cache-to inline \
42
+ --cache-from " type=registry,ref=${DOCKER_TAG} " \
43
+ --cache-from " type=registry,ref=${default_branch_tag} " \
54
44
--platform " $docker_platform " \
55
- -t " $image " \
45
+ -t " $DOCKER_TAG " \
56
46
--build-arg ARCH=" $ARCH " \
57
47
--build-arg CMAKE_ARCH=" $CMAKE_ARCH " \
58
48
" $repo_root " /ci
0 commit comments