-
Notifications
You must be signed in to change notification settings - Fork 11
68 lines (56 loc) · 1.97 KB
/
image-retention.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
name: Delete old container images
on:
schedule:
- cron: "15 */12 * * *" # run hourly
push:
branches:
- "*"
- "!main" # excludes main
paths:
- "github-actions/cleanup-packages/**"
- ".github/workflows/image-retention.yaml"
pull_request:
paths:
- "github-actions/cleanup-packages/**"
- ".github/workflows/image-retention.yaml"
workflow_dispatch:
jobs:
cleanup-packages:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: ./github-actions/cleanup-packages/go.mod
cache-dependency-path: ./github-actions/cleanup-packages/go.sum
- name: Verify dependencies
run: go mod verify
working-directory: ./github-actions/cleanup-packages/
- name: Build
run: go build -v ./...
working-directory: ./github-actions/cleanup-packages/
- name: Run go vet
run: go vet ./...
working-directory: ./github-actions/cleanup-packages/
- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@latest
working-directory: ./github-actions/cleanup-packages/
- name: Run staticcheck
run: staticcheck ./...
working-directory: ./github-actions/cleanup-packages/
- name: Install golint
run: go install golang.org/x/lint/golint@latest
working-directory: ./github-actions/cleanup-packages/
- name: Run golint
run: golint ./...
working-directory: ./github-actions/cleanup-packages/
- name: Run tests
run: go test -race -vet=off ./...
working-directory: ./github-actions/cleanup-packages/
- name: Delete Versions
if: github.ref == 'refs/heads/main'
run: go run ./cmd/cleanup/main.go
env:
PAT_CONTAINER_REGISTRY: ${{ secrets.PAT_CONTAINER_REGISTRY }}
working-directory: ./github-actions/cleanup-packages/