forked from pixelfed/pixelfed
-
Notifications
You must be signed in to change notification settings - Fork 2
79 lines (70 loc) · 2.96 KB
/
docker-cleanup.yml
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: Docker Cleanup
on:
workflow_dispatch:
inputs:
dry-run:
required: true
type: boolean
# See: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
- cron: "30 3 * * 1" # run at 03:30 AM UTC on mondays
jobs:
clean_registry:
name: Clean the container registry
runs-on: ubuntu-latest
steps:
# See: https://github.com/dataaxiom/ghcr-cleanup-action?tab=readme-ov-file#action-options
- if: always()
name: Delete old PR + Branch images
uses: dataaxiom/ghcr-cleanup-action@v1
with:
dry-run: ${{ github.event.inputs.dry-run || false }}
keep-n-tagged: 10
delete-tags: pr-*
exclude-tags: latest*,develop*,nightly*
# See: https://github.com/dataaxiom/ghcr-cleanup-action?tab=readme-ov-file#action-options
- if: always()
name: Delete old nightly images
uses: dataaxiom/ghcr-cleanup-action@v1
with:
dry-run: ${{ github.event.inputs.dry-run || false }}
keep-n-tagged: 10
delete-tags: nightly-*
exclude-tags: latest*,develop*
# See: https://github.com/dataaxiom/ghcr-cleanup-action?tab=readme-ov-file#action-options
- if: always()
name: Delete old develop images
uses: dataaxiom/ghcr-cleanup-action@v1
with:
dry-run: ${{ github.event.inputs.dry-run || false }}
keep-n-tagged: 10
delete-tags: develop-*
exclude-tags: latest*,nightly*
# See: https://github.com/dataaxiom/ghcr-cleanup-action?tab=readme-ov-file#action-options
#
# NOTE:
# The tool supports multi-arch images, so it checks if any untagged images is referenced
# by a tagged one before deleting - meaning that "untagged" here is NOT the same as the
# 'untagged images' tab in the GHCR UI
- if: always()
name: "Delete all untagged images"
uses: dataaxiom/ghcr-cleanup-action@v1
with:
dry-run: ${{ github.event.inputs.dry-run || false }}
delete-untagged: true
# See: https://github.com/dataaxiom/ghcr-cleanup-action?tab=readme-ov-file#action-options
- if: always()
name: "Delete all invalid images"
uses: dataaxiom/ghcr-cleanup-action@v1
with:
dry-run: ${{ github.event.inputs.dry-run || false }}
delete-ghost-images: true
delete-orphaned-images: true