From d45f2c3f62ce9e783c9b35cd29c67f109830237e Mon Sep 17 00:00:00 2001 From: sd109 Date: Mon, 2 Sep 2024 11:24:10 +0100 Subject: [PATCH] Only tag images as latest on main branch --- .../workflows/docker-build-push-backend-container-on-tag.yml | 2 +- .github/workflows/docker-build-push-web-container-on-tag.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-build-push-backend-container-on-tag.yml b/.github/workflows/docker-build-push-backend-container-on-tag.yml index f88bc949f46..e775f9530c2 100644 --- a/.github/workflows/docker-build-push-backend-container-on-tag.yml +++ b/.github/workflows/docker-build-push-backend-container-on-tag.yml @@ -35,7 +35,7 @@ jobs: push: true tags: | ${{ env.REGISTRY_IMAGE }}:${{ github.ref_name }} - ${{ env.REGISTRY_IMAGE }}:latest + ${{ github.ref == 'refs/heads/main' && format('type=raw,value={0}:latest', env.REGISTRY_IMAGE) }} build-args: | DANSWER_VERSION=${{ github.ref_name }} cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:buildcache diff --git a/.github/workflows/docker-build-push-web-container-on-tag.yml b/.github/workflows/docker-build-push-web-container-on-tag.yml index 13f59b7b8b4..8e15acd5e84 100644 --- a/.github/workflows/docker-build-push-web-container-on-tag.yml +++ b/.github/workflows/docker-build-push-web-container-on-tag.yml @@ -34,7 +34,7 @@ jobs: images: ${{ env.REGISTRY_IMAGE }} tags: | type=raw,value=${{ env.REGISTRY_IMAGE }}:${{ github.ref_name }} - type=raw,value=${{ env.REGISTRY_IMAGE }}:latest + ${{ github.ref == 'refs/heads/main' && format('type=raw,value={0}:latest', env.REGISTRY_IMAGE) }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3