From f8bc43000821e946887bd02eeea3249dd43f6dcb Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Mon, 29 Sep 2025 10:42:43 -0700 Subject: [PATCH] DEV-396: Tag images without forcing a rebuild --- .github/workflows/release.yml | 53 +++++++++++++---------------------- 1 file changed, 19 insertions(+), 34 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fc47d18..86d5f28 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,15 +6,22 @@ on: - '*' workflow_dispatch: +env: + DOCKER_METADATA_SET_OUTPUT_ENV: 'true' + jobs: - verify: + retag: runs-on: ubuntu-latest - outputs: - base_image: ${{ steps.get-base-image.outputs.tags }} steps: - name: Checkout code uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: @@ -30,33 +37,13 @@ jobs: tags: type=sha - name: Verify that the image was previously built - run: docker pull "$BASE_IMAGE" env: BASE_IMAGE: ${{ steps.get-base-image.outputs.tags }} - - retag: - runs-on: ubuntu-latest - needs: - - verify - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + run: | + docker pull "$BASE_IMAGE" - name: Produce release tags - id: meta + id: tag-meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository }} @@ -67,11 +54,9 @@ jobs: type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{version}} - - name: Retag and push the image - uses: docker/build-push-action@v6 - with: - cache-from: type=registry,ref=${{ needs.verify.outputs.base_image }} - labels: ${{ steps.meta.outputs.labels }} - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} + - name: Retag the pulled image + env: + BASE_IMAGE: ${{ steps.get-base-image.outputs.tags }} + run: | + echo "$DOCKER_METADATA_OUTPUT_TAGS" | tr ' ' '\n' | xargs -n1 docker tag "$BASE_IMAGE" + docker push --all-tags "$(echo "$BASE_IMAGE" | cut -f1 -d:)"