Skip to content

Clean-up single package #27

Clean-up single package

Clean-up single package #27

name: Delete old packages
on:
push:
workflow_dispatch:
inputs:
package:
description: "Package name"
required: true
type: choice
options:
# - test-cloud-server
# - cert-tool
# - grpc-gateway
# - coap-gateway
# - resource-directory
- identity-store
- http-gateway
- mock-oauth-server
- bundle
- resource-aggregate
- cloud2cloud-connector
- cloud2cloud-gateway
# - certificate-authority
- coap-gateway-go1-18
- nats-server-config-reloader
jobs:
ghcr-cleanup-old-packages:
name: Delete old tagged images
runs-on: ubuntu-latest
steps:
- name: Delete older than a month vnext images
uses: snok/container-retention-policy@v2
with:
image-names: hub/identity-store
cut-off: One month ago UTC
account-type: org
org-name: plgd-dev
filter-tags: vnext-*
skip-tags: vnext-pr*,main
token: ${{ secrets.GHCR_CLEANUP_PAT }}
- name: Delete older than a month vnext-pr images
uses: snok/container-retention-policy@v2
with:
image-names: hub/identity-store
cut-off: One week ago UTC
account-type: org
org-name: plgd-dev
filter-tags: vnext-pr*
skip-tags: main
token: ${{ secrets.GHCR_CLEANUP_PAT }}
ghcr-cleanup-untagged-packages:
name: Delete untagged packages
if: ${{ always() }}
runs-on: ubuntu-latest
needs: ghcr-cleanup-old-packages
steps:
- name: Set up Docker Buildx for delete untagged images action
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry for delete untagged images action
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_CLEANUP_PAT }}
- name: Delete untagged images with no dependency
uses: Chizkiyahu/delete-untagged-ghcr-action@v3
with:
package_name: hub/identity-store
repository: ${{ github.repository }}
repository_owner: ${{ github.repository_owner }}
token: ${{ secrets.GHCR_CLEANUP_PAT }}
owner_type: org
untagged_only: true
except_untagged_multiplatform: true