From 8d0186b53d6e890c14325110b8a56a28985a8128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20M=C3=BCller?= <63012534+eliasmueller@users.noreply.github.com> Date: Mon, 7 Oct 2024 10:57:41 +0200 Subject: [PATCH] ci: add deletion of untagged images (#3) --- .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