Skip to content

Commit

Permalink
Merge pull request #11 from reload/cleanup
Browse files Browse the repository at this point in the history
Clean old images after pushing new ones
  • Loading branch information
arnested authored Jun 28, 2024
2 parents 9e4cbf4 + 498eb18 commit f715b4c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,20 @@ jobs:
org.opencontainers.image.revision=${{ github.sha }}
tags: |
ghcr.io/${{ github.repository }}:${{ matrix.derivate }}
cleanup:
name: Cleanup
runs-on: ubuntu-22.04
needs:
- derivates
- build
steps:
- name: Count how many images to keep
id: count
run: >-
echo "keep_images=$(jq '. | length * 5' <<< '${{ needs.derivates.outputs.matrix }}')" >> "$GITHUB_OUTPUT"
- name: Delete old container packages
uses: actions/delete-package-versions@v5
with:
package-name: ${{ github.event.repository.name }}
package-type: container
min-versions-to-keep: ${{ steps.count.outputs.keep_images }}

0 comments on commit f715b4c

Please sign in to comment.