From 52916e6ad9a5580edaa76f2f2ce9090eceec2a3b Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Tue, 17 Oct 2023 12:52:14 +0200 Subject: [PATCH 1/3] Enable tags only for semver and default branch --- .github/workflows/docker-publish.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index c06ab2e..b5da39a 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -49,6 +49,7 @@ jobs: - name: Setup Docker buildx uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf + # Login against a Docker registry except on PR # https://github.com/docker/login-action - name: Log into registry ${{ env.REGISTRY }} @@ -66,6 +67,12 @@ jobs: uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=raw,value=latest,enable=${{github.ref == 'refs/heads/main'}} + type=semver,pattern=v{{major}}.{{minor}} + type=semver,pattern={{version}},value=v${{ inputs.tags }},enable=${{ inputs.tags != '' }} + flavor: | + latest=false # Build and push Docker image with Buildx (don't push on PR) # https://github.com/docker/build-push-action From 53fc431119a4d0f7fa4e6e3154ae1b52abba7ace Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Wed, 18 Oct 2023 11:10:23 +0200 Subject: [PATCH 2/3] Use refname as tag name for images --- .github/workflows/docker-publish.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index b5da39a..fa84846 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -67,10 +67,7 @@ jobs: uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=raw,value=latest,enable=${{github.ref == 'refs/heads/main'}} - type=semver,pattern=v{{major}}.{{minor}} - type=semver,pattern={{version}},value=v${{ inputs.tags }},enable=${{ inputs.tags != '' }} + tags: ${{ github.ref_name }} flavor: | latest=false From 824095c599f01bb3a443e0d6391452dac29e7f80 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Wed, 18 Oct 2023 12:36:39 +0200 Subject: [PATCH 3/3] Use default tags without sha fallback --- .github/workflows/docker-publish.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index fa84846..0b2f9ed 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -67,7 +67,12 @@ jobs: uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: ${{ github.ref_name }} + tags: | + type=schedule + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=ref,event=branch flavor: | latest=false