Cleanup Untagged Images #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cleanup Untagged Images | |
on: | |
# every sunday at 00:00 | |
schedule: | |
- cron: "0 0 * * SUN" | |
# or manually | |
workflow_dispatch: | |
env: | |
# Use docker.io for Docker Hub if empty | |
REGISTRY: ghcr.io | |
jobs: | |
delete-untagged-images: | |
name: Delete Untagged Images | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
# This is used to complete the identity challenge | |
# with sigstore/fulcio when running outside of PRs. | |
id-token: write | |
strategy: | |
matrix: | |
image_name: [conda-jax, basicpy-docker-mcmicro] | |
steps: | |
# Login against a Docker registry except on PR | |
# https://github.com/docker/login-action | |
- name: Log into registry ${{ env.REGISTRY }} | |
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: bots-house/[email protected] | |
with: | |
# NOTE: at now only orgs is supported | |
owner: yfukai | |
name: ${{ matrix.image_name }} | |
# NOTE: using Personal Access Token | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# Keep latest N untagged images | |
untagged-keep-latest: 2 |