From 2766ecbdb5c47443a57b026ae79e97c0f1bdd562 Mon Sep 17 00:00:00 2001 From: Roberto Cella Date: Sun, 15 Oct 2023 17:14:16 +0200 Subject: [PATCH 1/2] disable main tag creation and delete branch tag on merge --- .github/workflows/docker-image.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index d962d9a..559614d 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -32,7 +32,7 @@ jobs: rob93c/christmas-greeter tags: | type=raw,value=latest,enable={{is_default_branch}} - type=ref,event=branch + type=ref,event=branch,enable=${{ github.ref != 'refs/heads/main' }} type=ref,event=pr - name: Upload Docker image @@ -43,3 +43,10 @@ jobs: tags: ${{ steps.metadata.outputs.tags }} cache-from: type=gha cache-to: type=gha,mode=max + + - name: Delete Docker tag + if: github.event.pull_request.merged + run: | + tag_to_delete="pr-${{github.event.issue.number}}" + docker rmi rob93c/christmas-greeter:$tag_to_delete + echo "The tag $tag_to_delete has been deleted" From 8cdb0ff239c24a9b63009a8d9da77f368805405c Mon Sep 17 00:00:00 2001 From: Roberto Cella Date: Sun, 15 Oct 2023 17:16:19 +0200 Subject: [PATCH 2/2] fix master branch name --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 559614d..3f85517 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -32,7 +32,7 @@ jobs: rob93c/christmas-greeter tags: | type=raw,value=latest,enable={{is_default_branch}} - type=ref,event=branch,enable=${{ github.ref != 'refs/heads/main' }} + type=ref,event=branch,enable=${{ github.ref != 'refs/heads/master' }} type=ref,event=pr - name: Upload Docker image