-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreusable-cleanup-repository.yaml
More file actions
60 lines (51 loc) · 1.55 KB
/
reusable-cleanup-repository.yaml
File metadata and controls
60 lines (51 loc) · 1.55 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
name: Cleanup Repository Resources
on:
workflow_call:
inputs:
skip_deployment_cleanup:
description: Boolean flag to skip the deployment-cleanup job. Should be used if the repository does not create deployments.
type: boolean
required: false
default: false
skip_ghcr_cleanup:
description: Boolean flag to skip the ghcr-cleanup job. Should be used if the repository does not publish a package.
type: boolean
required: false
default: false
jobs:
deployment-cleanup:
if: ${{ !inputs.skip_deployment_cleanup }}
runs-on: ubuntu-latest
name: Cleanup Inactive Deployments
strategy:
matrix:
environment:
- development
- staging
- production
steps:
- uses: lockerstock/github-actions/delete-inactive-deployments@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment: ${{ matrix.environment }}
ghcr-cleanup:
if: ${{ !inputs.skip_ghcr_cleanup }}
runs-on: ubuntu-latest
name: Cleanup GitHub Container Registry
permissions:
contents: read
packages: write
steps:
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: lockerstock/github-actions/cleanup-ghcr@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
keep_git_tags: true
duration_to_keep: '30d'
tags_to_keep: |
staging
latest