diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 8a3d3a4cb..10258664a 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -135,6 +135,15 @@ jobs: format('type=registry,ref={0}:{1}-latest-buildcache', env.IMAGE_NAME, matrix.tag) ) || format('type=registry,ref={0}:latest-buildcache', env.IMAGE_NAME) ) }} + IMAGE_CACHE_TO: + |- # If it's a release, do not create buildcache, otherwise create the `latest` buildcache. :latest-buildcache or :{tag}-latest-buildcache + ${{ ( + needs.config.outputs.version_or_latest == 'latest' && ( + matrix.tag != '' && ( + format('type=registry,ref={0}:{1}-latest-buildcache,mode=max', env.IMAGE_NAME, matrix.tag) + ) || format('type=registry,ref={0}:latest-buildcache,mode=max', env.IMAGE_NAME) + ) || '' + ) }} with: context: . builder: ${{ steps.buildx.outputs.name }} @@ -152,7 +161,7 @@ jobs: push: true tags: ${{ env.IMAGE_TAG }} cache-from: ${{ env.IMAGE_CACHE_FROM }} - cache-to: type=registry,ref=${{ env.IMAGE_TAG }}-buildcache,mode=max + cache-to: ${{ env.IMAGE_CACHE_TO }} platforms: ${{ matrix.platforms }} run-release-test-workflow: