chore(ci): add GHCR cleanup job to delete old container image versions

Each push creates a ~770MB container image tagged with the commit SHA.
Add a cleanup job that runs after integration tests complete, keeping
only the most recent version and deleting all others.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Clint Branham
2026-03-19 13:49:21 -05:00
parent d995479c8e
commit c6da302742
+16
View File
@@ -89,6 +89,22 @@ jobs:
push: true
tags: ${{ env.TEST_IMAGE }}:${{ github.sha }},${{ env.TEST_IMAGE }}:latest
# ── Clean up old container images from GHCR ──────────────────────────
cleanup-images:
needs: integration
if: always()
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Delete old container image versions
uses: actions/delete-package-versions@v5
with:
package-name: psproxmoxve-integration
package-type: container
min-versions-to-keep: 1
delete-only-untagged-versions: false
token: ${{ secrets.GITHUB_TOKEN }}
# ── Integration tests (self-hosted runner in Docker container) ───────
integration:
needs: [build, container-image]