From 48f563d67ebe6935bd3fc0a71320b1217848428e Mon Sep 17 00:00:00 2001 From: Felix Moessbauer Date: Thu, 13 Jun 2024 15:00:55 +0200 Subject: [PATCH] ci: delete old container images This action "correctly" deletes old (untagged) container images and the corresponding attestations. It also handles the multi-arch images correctly. Signed-off-by: Felix Moessbauer Signed-off-by: Jan Kiszka --- .github/workflows/next.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/next.yml b/.github/workflows/next.yml index a26c782b..869f3249 100644 --- a/.github/workflows/next.yml +++ b/.github/workflows/next.yml @@ -120,3 +120,20 @@ jobs: subject-name: ghcr.io/${{ github.repository }}/${{ matrix.image-name }} subject-digest: ${{ steps.push.outputs.digest }} push-to-registry: true + + cleanup_ghcr_containers: + name: cleanup untagged ${{ matrix.image-name }} containers + runs-on: ubuntu-latest + needs: build_containers + permissions: + packages: write + strategy: + matrix: + image-name: ["kas", "kas-isar"] + steps: + - uses: dataaxiom/ghcr-cleanup-action@v1.0.5 + with: + dry-run: false + validate: true + package: kas/${{ matrix.image-name }} + token: ${{ secrets.GITHUB_TOKEN }}