From 7563bd4f9c5aa92e7bd0820567632b5458d70e2f Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Mon, 11 Dec 2023 16:24:55 -0800 Subject: [PATCH] Extract TAG_PREFIX --- .github/workflows/publish_image.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish_image.yml b/.github/workflows/publish_image.yml index fbb5da8..b643cdf 100644 --- a/.github/workflows/publish_image.yml +++ b/.github/workflows/publish_image.yml @@ -36,16 +36,22 @@ jobs: - name: Setup Docker buildx uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 # v2.0.0 - - name: Prepare metadata + - name: Extract tag prefix + id: extract_tag + run: | + TAG_PREFIX=$(echo "${{ matrix.base-image }}" | sed -E 's/[^:]+:([^@]+)@.*/\1/') + echo "TAG_PREFIX=$TAG_PREFIX" >> $GITHUB_ENV + + + - name: Prepare metadata id: meta - uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a # v4.0.1 + uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | - type=sha,enable=true,prefix=git- + type=raw,value=${{ env.TAG_PREFIX }} type=raw,value=latest - type=raw,value=${{ matrix.base-image | replace('/','-') | replace(':','-') | replace('@','-') }} - + - name: Log into registry ${{ env.REGISTRY }} uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # v2.0.0 with: