Skip to content

Commit

Permalink
chore: clean untagged images
Browse files Browse the repository at this point in the history
  • Loading branch information
nanpuyue committed Sep 20, 2023
1 parent 756ff72 commit d8ffb7f
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/docker-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ on:
workflow_dispatch:

env:
REGISTRY_IMAGE: ghcr.io/${{ github.repository }}-builder
PACKAGE_NAME: avatar-bot-builder
REGISTRY_IMAGE: ghcr.io/nanpuyue/avatar-bot-builder

jobs:
build:
Expand Down Expand Up @@ -62,6 +63,7 @@ jobs:
retention-days: 1

merge:
name: merge multi-platform images
runs-on: ubuntu-latest
permissions:
packages: write
Expand All @@ -80,6 +82,10 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
flavor: |
latest=true
tags: |
type=raw,value={{date 'YYYYMMDD'}}
images: ${{ env.REGISTRY_IMAGE }}
- name: Log in to the Container registry
uses: docker/login-action@v3
Expand All @@ -91,7 +97,15 @@ jobs:
working-directory: ./digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON")\
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Clean untagged images
uses: actions/delete-package-versions@v4
with:
package-name: ${{ env.PACKAGE_NAME }}
package-type: container
min-versions-to-keep: 0
delete-only-untagged-versions: true
token: ${{ secrets.DELETE_TOKEN }}
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}

0 comments on commit d8ffb7f

Please sign in to comment.