From 8a65ef82f6bd13b9500efb90e27a949eaf1046bd Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Sun, 11 Feb 2024 21:04:33 +0900 Subject: [PATCH] Prepare universal workflow --- .github/workflows/images_build.yml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/images_build.yml b/.github/workflows/images_build.yml index 03dfe73e3..608eb34b3 100644 --- a/.github/workflows/images_build.yml +++ b/.github/workflows/images_build.yml @@ -858,6 +858,22 @@ jobs: "$BASE_IMAGE" echo "::endgroup::" + - name: Prepare cache data + id: cache_data + env: + BASE_IMAGE_TAG: ${{ steps.base_build.outputs.base_build_image }} + run: | + cache_images="" + if [[ ! -z "$BASE_IMAGE_TAG" ]]; then + cache_images="type=gha,scope=$BASE_IMAGE_TAG\ntype=registry,ref=$BASE_IMAGE_TAG" + fi + + echo "::group::Base images cache" + echo "$cache_images" + echo "::endgroup::" + + echo "cache_from=$cache_images" >> $GITHUB_OUTPUT + - name: Build and push image id: docker_build uses: docker/build-push-action@v5 @@ -871,9 +887,7 @@ jobs: labels: | org.opencontainers.image.revision=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} org.opencontainers.image.created=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} - cache-from: | - type=gha,scope=${{ steps.base_build.outputs.base_build_image }} - type=registry,ref=${{ steps.base_build.outputs.base_build_image }} + cache-from: ${{ steps.cache_data.outputs.cache_from }} - name: Sign the images with GitHub OIDC Token env: