Repository navigation
125 lines (108 loc) · 4.52 KB
/
Copy pathcleanup-packages.yml
File metadata and controls
125 lines (108 loc) · 4.52 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Cleanup Untagged Packages
on:
schedule:
# Run every Sunday at 02:00 UTC
- cron: '0 2 * * 0'
workflow_dispatch:
env:
REGISTRY: ghcr.io
jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Debug package information
run: |
echo "Repository: ${{ github.repository }}"
echo "Repository owner: ${{ github.repository_owner }}"
echo "Repository name: ${{ github.event.repository.name }}"
- name: Delete untagged main container images
id: cleanup-main
continue-on-error: true
uses: actions/delete-package-versions@v5
with:
package-name: ${{ github.event.repository.name }}
package-type: container
min-versions-to-keep: 20
delete-only-untagged-versions: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Delete untagged ohpc-lint images
id: cleanup-lint
continue-on-error: true
uses: actions/delete-package-versions@v5
with:
package-name: ohpc-lint
package-type: container
min-versions-to-keep: 20
delete-only-untagged-versions: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Delete untagged ohpc-analysis images
id: cleanup-analysis
continue-on-error: true
uses: actions/delete-package-versions@v5
with:
package-name: ohpc-analysis
package-type: container
min-versions-to-keep: 20
delete-only-untagged-versions: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Delete untagged ohpc-validate-almalinux images
id: cleanup-validate-almalinux
continue-on-error: true
uses: actions/delete-package-versions@v5
with:
package-name: ohpc-validate-almalinux
package-type: container
min-versions-to-keep: 20
delete-only-untagged-versions: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Delete untagged ohpc-validate-openeuler images
id: cleanup-validate-openeuler
continue-on-error: true
uses: actions/delete-package-versions@v5
with:
package-name: ohpc-validate-openeuler
package-type: container
min-versions-to-keep: 20
delete-only-untagged-versions: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Delete untagged ohpc-validate-leap images
id: cleanup-validate-leap
continue-on-error: true
uses: actions/delete-package-versions@v5
with:
package-name: ohpc-validate-leap
package-type: container
min-versions-to-keep: 20
delete-only-untagged-versions: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Report cleanup results
run: |
echo "Cleanup Results:"
echo "Main container cleanup: ${{ steps.cleanup-main.outcome }}"
echo "Lint container cleanup: ${{ steps.cleanup-lint.outcome }}"
echo "Analysis container cleanup: ${{ steps.cleanup-analysis.outcome }}"
echo "Validate AlmaLinux container cleanup: ${{ steps.cleanup-validate-almalinux.outcome }}"
echo "Validate openEuler container cleanup: ${{ steps.cleanup-validate-openeuler.outcome }}"
echo "Validate Leap container cleanup: ${{ steps.cleanup-validate-leap.outcome }}"
if [[ "${{ steps.cleanup-main.outcome }}" == "failure" ]]; then
echo "Warning: Main container cleanup failed - package may not exist yet"
fi
if [[ "${{ steps.cleanup-lint.outcome }}" == "failure" ]]; then
echo "Warning: Lint container cleanup failed - package may not exist yet"
fi
if [[ "${{ steps.cleanup-analysis.outcome }}" == "failure" ]]; then
echo "Warning: Analysis container cleanup failed - package may not exist yet"
fi
if [[ "${{ steps.cleanup-validate-almalinux.outcome }}" == "failure" ]]; then
echo "Warning: Validate AlmaLinux container cleanup failed - package may not exist yet"
fi
if [[ "${{ steps.cleanup-validate-openeuler.outcome }}" == "failure" ]]; then
echo "Warning: Validate openEuler container cleanup failed - package may not exist yet"
fi
if [[ "${{ steps.cleanup-validate-leap.outcome }}" == "failure" ]]; then
echo "Warning: Validate Leap container cleanup failed - package may not exist yet"
fi
echo "Cleanup workflow completed"