forked from cloudnative-pg/cloudnative-pg
-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (39 loc) · 1.54 KB
/
registry-clean.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
# This workflow runs daily to clean up the `*-testing` images older than the
# cut-off period specified in `snok/container-retention-policy`
name: clean-testing-package
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
env:
IMAGE_NAME: "cloudnative-pg-testing"
ORG_NAME: "cloudnative-pg"
SNOK_TOKEN: ${{ secrets.REPO_GHA_PAT }}
CONTAINER_IMAGE_NAMES: "pgbouncer-testing, postgresql-testing, postgis-testing"
jobs:
clean-ghcr:
name: delete old testing container images
runs-on: ubuntu-latest
steps:
# once issue https://github.com/snok/container-retention-policy/issues/33 is fixed
# we can merge the two steps into one
- name: Delete '-testing' images for ${{ env.IMAGE_NAME }}
uses: snok/container-retention-policy@v2
with:
image-names: ${{ env.IMAGE_NAME }}
cut-off: 5 days ago UTC
keep-at-least: 1
account-type: org
org-name: ${{ env.ORG_NAME }}
# use the GITHUB_TOKEN when issue https://github.com/snok/container-retention-policy/issues/27 is fixed
token: ${{ env.SNOK_TOKEN }}
- name: Delete '-testing' images for containers
uses: snok/container-retention-policy@v2
with:
image-names: ${{ env.CONTAINER_IMAGE_NAMES }}
cut-off: A week ago UTC
keep-at-least: 1
account-type: org
org-name: ${{ env.ORG_NAME }}
# use the GITHUB_TOKEN when issue https://github.com/snok/container-retention-policy/issues/27 is fixed
token: ${{ env.SNOK_TOKEN }}