From 81d2e6cb6e81995c9f67ab1e45cc78516d3989c1 Mon Sep 17 00:00:00 2001 From: jidicula Date: Wed, 2 Mar 2022 10:51:56 -0500 Subject: [PATCH] ci(image): Run untagged image cleanup after image publish Run cleanup as subsequent job dependent on image publishing. --- .github/workflows/clang-format-image.yml | 16 ++++++++++++-- .github/workflows/stale-image-clean.yml | 27 ------------------------ 2 files changed, 14 insertions(+), 29 deletions(-) delete mode 100644 .github/workflows/stale-image-clean.yml diff --git a/.github/workflows/clang-format-image.yml b/.github/workflows/clang-format-image.yml index beaab7d..c857d83 100644 --- a/.github/workflows/clang-format-image.yml +++ b/.github/workflows/clang-format-image.yml @@ -9,7 +9,7 @@ on: - '.github/workflows/clang-format-image.yml' workflow_dispatch: schedule: - - cron: '5 3 * * *' + - cron: '5 4 * * *' # Daily at 04:05 defaults: run: @@ -20,7 +20,7 @@ env: IMAGE_NAME: clang-format jobs: - get-binary: + publish-image: name: clang-format ${{ matrix.version-pair.version }} runs-on: ubuntu-latest strategy: @@ -68,3 +68,15 @@ jobs: build-args: | "UBUNTU_VERSION=${{ matrix.version-pair.ubuntu }}" "CLANG_FORMAT_VERSION=${{ matrix.version-pair.version }}" + clean-untagged-images: + needs: publish-image + name: Clean untagged images + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v2 + with: + go-version: '1.17' + - name: Install ghcr-cleaner + run: go install github.com/jidicula/ghcr-cleaner@latest + - name: Run ghcr-cleaner + run: ghcr-cleaner --token "${{ secrets.GHCR_DELETE_TOKEN }}" --packagename clang-format diff --git a/.github/workflows/stale-image-clean.yml b/.github/workflows/stale-image-clean.yml deleted file mode 100644 index 6c068b4..0000000 --- a/.github/workflows/stale-image-clean.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: stale-image-clean - -on: - schedule: - - cron: '5 4 * * *' - workflow_dispatch: - -defaults: - run: - shell: bash - -env: - REGISTRY: ghcr.io - IMAGE_NAME: clang-format - -jobs: - clean-untagged-images: - name: Clean untagged images - runs-on: ubuntu-latest - steps: - - uses: actions/setup-go@v2 - with: - go-version: '1.17' - - name: Install ghcr-cleaner - run: go install github.com/jidicula/ghcr-cleaner@latest - - name: Run ghcr-cleaner - run: ghcr-cleaner --token "${{ secrets.GHCR_DELETE_TOKEN }}" --packagename clang-format