@@ -31,28 +31,18 @@ CMAKE_ARCH="${CMAKE_ARCH:-"$ARCH"}"
3131cwd=" $PWD "
3232repo_root=" $( readlink -f " $( dirname " $0 " ) " /..) "
3333
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} "
3636
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)"
5038
5139# building local image to " cache" installed dependencies for subsequent builds
5240docker 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} " \
5444 --platform " $docker_platform " \
55- -t " $image " \
45+ -t " $DOCKER_TAG " \
5646 --build-arg ARCH=" $ARCH " \
5747 --build-arg CMAKE_ARCH=" $CMAKE_ARCH " \
5848 " $repo_root " /ci
0 commit comments