From 3d8dcab74d5046392ecc8903061100c268e5c71c Mon Sep 17 00:00:00 2001 From: Matthias Neugebauer Date: Fri, 12 Jul 2024 12:02:47 +0200 Subject: [PATCH] Add back container image cleanup steps --- .github/workflows/container-images.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/container-images.yml b/.github/workflows/container-images.yml index ae3dbec..e015b3b 100644 --- a/.github/workflows/container-images.yml +++ b/.github/workflows/container-images.yml @@ -69,3 +69,21 @@ jobs: VERSION=${{ steps.info.outputs.VERSION }} \ IMAGE_PLATFORMS=${{ env.IMAGE_PLATFORMS }} \ BUILDX_OUTPUT="${BUILDX_OUTPUT}" + + - name: fetch container image shas + id: container-image + run: | + shas=$(docker manifest inspect ghcr.io/nagare-media/engine/${{ matrix.image }}:${{ steps.info.outputs.VERSION }} | jq -r '.manifests.[] | .digest' | paste -s -d ' ' -) + echo "SHAS=$shas" | tee -a "$GITHUB_OUTPUT" + + - name: delete untagged container images + uses: snok/container-retention-policy@v3.0.0 + if: ${{ github.event_name == 'push' }} + with: + account: nagare-media + token: ${{ secrets.GITHUB_TOKEN }} + tag-selection: untagged + image-names: engine/${{ matrix.image }} + image-tags: ${{ steps.info.outputs.VERSION }} + skip-shas: ${{ steps.container-image.outputs.SHAS }} + cut-off: 0s