-
Notifications
You must be signed in to change notification settings - Fork 1
79 lines (73 loc) · 2.66 KB
/
Copy pathghcr-cleanup.yml
File metadata and controls
79 lines (73 loc) · 2.66 KB
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: GHCR Cleanup
on:
schedule:
- cron: '0 3 * * 0' # Sundays 03:00 UTC
workflow_dispatch:
inputs:
dry-run:
description: 'Dry run (preview deletions without executing)'
type: boolean
default: false
jobs:
cleanup-app-images:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Delete old commit-tagged images (keep semver + main + latest)
uses: snok/container-retention-policy@v3.0.1
with:
account: ${{ github.repository_owner }}
token: ${{ secrets.GITHUB_TOKEN }}
image-names: ${{ github.event.repository.name }}
image-tags: "!v*-full !v*-simple !main-full !main-simple !latest"
tag-selection: tagged
cut-off: 30d
dry-run: ${{ github.event.inputs.dry-run || 'false' }}
- name: Delete untagged app image manifests
uses: snok/container-retention-policy@v3.0.1
with:
account: ${{ github.repository_owner }}
token: ${{ secrets.GITHUB_TOKEN }}
image-names: ${{ github.event.repository.name }}
tag-selection: untagged
cut-off: 7d
dry-run: ${{ github.event.inputs.dry-run || 'false' }}
cleanup-cache-images:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Delete untagged buildx cache manifests
uses: snok/container-retention-policy@v3.0.1
with:
account: ${{ github.repository_owner }}
token: ${{ secrets.GITHUB_TOKEN }}
image-names: ${{ github.event.repository.name }}/cache
tag-selection: untagged
cut-off: 7d
dry-run: ${{ github.event.inputs.dry-run || 'false' }}
cleanup-sif-images:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Delete old commit-tagged SIFs (keep semver + main + latest)
uses: snok/container-retention-policy@v3.0.1
with:
account: ${{ github.repository_owner }}
token: ${{ secrets.GITHUB_TOKEN }}
image-names: ${{ github.event.repository.name }}/sif
image-tags: "!v*-full !v*-simple !main-full !main-simple !latest"
tag-selection: tagged
cut-off: 30d
dry-run: ${{ github.event.inputs.dry-run || 'false' }}
- name: Delete untagged SIF manifests
uses: snok/container-retention-policy@v3.0.1
with:
account: ${{ github.repository_owner }}
token: ${{ secrets.GITHUB_TOKEN }}
image-names: ${{ github.event.repository.name }}/sif
tag-selection: untagged
cut-off: 7d
dry-run: ${{ github.event.inputs.dry-run || 'false' }}