Skip to content

Commit cca6dd1

Browse files
committed
Cache to GHA when running in the PR.
1 parent 276cc95 commit cca6dd1

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/rtpproxy_ci.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,15 @@ jobs:
478478
OS_TAG="`echo ${BASE_IMAGE} | sed 's|:|_|g'`"
479479
BRANCH_TAG="`echo ${GIT_BRANCH} | sed 's|/|_|g'`"
480480
CCACHE_IMAGE="${{ env.GHCR_REPO }}:${BRANCH_TAG}-${OS_TAG}-cccache"
481+
CACHE_SPEC="type=registry,ref=${CCACHE_IMAGE}"
482+
if [ "${DOCKER_RW}" = "true" ]
483+
then
484+
CACHE_TO="${CACHE_SPEC},mode=max"
485+
else
486+
CACHE_TO="gha"
487+
fi
488+
echo "CACHE_SPEC=${CACHE_SPEC}" >> $GITHUB_ENV
489+
echo "CACHE_TO=${CACHE_TO}" >> $GITHUB_ENV
481490
if ! docker pull ${CCACHE_IMAGE} 2>&1 >/dev/null
482491
then
483492
CCACHE_BIMAGE="scratch"
@@ -539,7 +548,6 @@ jobs:
539548
- name: Build Docker image
540549
uses: docker/build-push-action@v6
541550
env:
542-
CACHE_SPEC: "type=registry,ref=${{ env.GHCR_REPO }}:${{ env.BRANCH_TAG }}-${{ env.OS_TAG }}-buildcache"
543551
DOCKER_BUILD_SUMMARY: false
544552
DOCKER_BUILD_RECORD_UPLOAD: false
545553
with:
@@ -558,7 +566,7 @@ jobs:
558566
platforms: ${{ env.PLATFORMS }}
559567
push: true
560568
cache-from: ${{ env.CACHE_SPEC }}
561-
cache-to: ${{ env.CACHE_SPEC }},mode=max
569+
cache-to: ${{ env.CACHE_TO }}
562570

563571
- name: Export ccache
564572
if: env.DOCKER_RW == 'true'

0 commit comments

Comments
 (0)