Skip to content

Commit

Permalink
removed main tag generation, changed command to delete only current p…
Browse files Browse the repository at this point in the history
…r's tag
  • Loading branch information
rob93c committed Oct 6, 2023
1 parent 279116d commit 7a09bc7
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
rob93c/stickerify
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
type=ref,event=pr
- name: Upload Docker image
Expand All @@ -44,14 +43,9 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Delete Docker tags
if: github.ref == 'refs/heads/main'
- name: Delete Docker tag
if: github.event.pull_request.merged
run: |
tags_to_keep=("latest" "native")
tags=$(curl -s "https://hub.docker.com/v2/repositories/rob93c/stickerify/tags/" | jq -r '.results[].name')
for tag in $tags; do
if [[ ! " ${tags_to_keep[@]} " =~ " ${tag} " ]]; then
docker rmi rob93c/stickerify:$tag
fi
done
tag_to_delete="pr-${{github.event.issue.number}}"
docker rmi rob93c/stickerify:$tag_to_delete
echo "The tag $tag_to_delete has been deleted"

0 comments on commit 7a09bc7

Please sign in to comment.