-
-
Notifications
You must be signed in to change notification settings - Fork 17
79 lines (74 loc) · 2.41 KB
/
ghcr-cleanup-package.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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