Skip to content

Commit

Permalink
purge old images. keep 5 more recent
Browse files Browse the repository at this point in the history
  • Loading branch information
romeroalx committed Dec 15, 2023
1 parent 6631a44 commit 07677b3
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/build-debian-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,29 @@ jobs:
if: ${{ github.event_name != 'pull_request' }}
run: |
docker push ${{ env.image-id-lowercase }}:${{ env.IMAGE_TAG }}
purge-old-images:
name: Purge old images.
# if: ${{ github.event.schedule || github.event.workflow_dispatch }}
# Delete below
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'push' }}
strategy:
matrix:
include:
- image-id: debian-11-pdns-base
- image-id: debian-12-pdns-base
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Get repository name
run: |
echo "${{ github.repository }}" | awk -F'/' '{print "repo-name="$2}' >> "$GITHUB_ENV"
- name: Purge old images keeping the 5 more recent ones
uses: actions/delete-package-versions@v4
with:
package-name: ${{ env.repo-name }}/${{ matrix.debian-release-name }}
package-type: container
min-versions-to-keep: 5

0 comments on commit 07677b3

Please sign in to comment.