Skip to content

Commit

Permalink
Update container image cleanup GitHub actions
Browse files Browse the repository at this point in the history
Switch to dataaxiom/ghcr-cleanup-action which treats multi-arch images
correctly and refactor the cleanup jobs so that we delete untagged
versions once a day from Monday to Friday and delete PR tags once the PR
is closed (merged or unmerged).
  • Loading branch information
simu committed Jul 26, 2024
1 parent 14ba118 commit 95f1a7c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/gitlab-container-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,10 @@ jobs:
platforms: linux/amd64,linux/arm64
push: true
tags: 'ghcr.io/${{ env.IMAGE }}:${{ env.VERSION }}'

- name: Delete PR container image when PR is closed
if: github.event.pull_request.state == 'closed'
uses: dataaxiom/ghcr-cleanup-action@v1
with:
tags: ${{ env.VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
11 changes: 4 additions & 7 deletions .github/workflows/prune-old-container-images.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Prune old container images
name: Prune untagged container images

"on":
schedule:
Expand All @@ -10,10 +10,7 @@ jobs:
prune:
runs-on: ubuntu-latest
steps:
- uses: actions/delete-package-versions@v5
- uses: dataaxiom/ghcr-cleanup-action@v1
with:
package-name: "${{ github.repository }}-gitlab"
package-type: container
# never delete release versions or latest
ignore-versions: "^(v.*|latest)$"
min-versions-to-keep: 3
token: ${{ secrets.GITHUB_TOKEN }}
validate: true

0 comments on commit 95f1a7c

Please sign in to comment.