From 305a5c68287bc30767cf17ad19804b80b81ff5ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20M=C3=BCller?= Date: Mon, 7 Oct 2024 10:26:08 +0200 Subject: [PATCH] ci: add deletion of untagged images --- .github/workflows/buildAndPushImage.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/buildAndPushImage.yml b/.github/workflows/buildAndPushImage.yml index 45692b7..662cb3d 100644 --- a/.github/workflows/buildAndPushImage.yml +++ b/.github/workflows/buildAndPushImage.yml @@ -28,3 +28,18 @@ jobs: - name: Push the Docker image run: docker push $IMAGE_URL/$IMAGE_NAME:$IMAGE_TAG + + delete-untagged-images: + needs: + - build-using-dockerfile-push-2-ghcr + runs-on: ubuntu-latest + steps: + - uses: actions/delete-package-versions@v5 + with: + owner: ${{ github.repository_owner }} + package-name: ${{ env.IMAGE_NAME }} + package-type: "container" + token: ${{ secrets.GITHUB_TOKEN }} + min-versions-to-keep: 3 + delete-only-pre-release-versions: "true" + delete-only-untagged-versions: "true" \ No newline at end of file