Skip to content

Prune ghcr.io

Prune ghcr.io #114

Workflow file for this run

# Prunes old aissemble-* untagged containers
name: Prune ghcr.io
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# schedule:
# - cron: "0 0 * * *" # every day at midnight
jobs:
build:
runs-on: ubuntu-latest
steps:
# Prevents multi-platform release images from being pruned by identifying all manifest lists
- name: Fetch multi-platform package version SHAs
id: multi-arch-digests
run: |
chmod +x .github/scripts/release_images.sh
.github/scripts/release_images.sh
# Prevents the latest snapshot images from being pruned by identifying all manifest lists
- name: Fetch latest snapshot version SHAs
id: latest-snapshot-digests
run: |
chmod +x .github/scripts/snapshot_images.sh
.github/scripts/snapshot_images.sh
- name: Concatenate digests
id: concat-digests
run: |
skip_shas="${{ steps.multi-arch-digests.outputs.multi-arch-digests }},${{ steps.latest-snapshot-digests.outputs.latest-snapshot-digests }}"
echo "skip_shas=$skip_shas" >> $GITHUB_OUTPUT
- name: Prune old release versions
uses: snok/container-retention-policy@v3.0.0
with:
skip-shas: ${{ steps.concat-digests.outputs.skip_shas }}
image-names: aissemble-*
image-tags: "!1.7.0 !1.7.0-arm64 !1.7.0-amd64"
cut-off: Two days ago UTC
account-type: org
org-name: boozallen
keep-at-least: 2
# untagged-only: true
dry-run: true
token: ${{ secrets.GHCR_IO_TOKEN }}