Skip to content
This repository has been archived by the owner on Jun 26, 2024. It is now read-only.

Clean Artifact Registry #81

Clean Artifact Registry

Clean Artifact Registry #81

name: Clean Artifact Registry
on:
workflow_dispatch:
schedule:
- cron: '14 3 * * 1'
env:
PROJECT_ID: freenet-353920
GAR_LOCATION: us-east1
REPO_LOCATION: $GAR_LOCATION-docker.pkg.dev/freenet-repo
IMAGE_PATH1: $REPO_LOCATION/freenet-org-production
IMAGE_PATH2: $REPO_LOCATION/freenet-org-staging
jobs:
gcr-cleaner:
runs-on: 'ubuntu-latest'
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Checkout
uses: actions/checkout@v3
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v0'
with:
token_format: 'access_token'
workload_identity_provider: 'projects/516912345376/locations/global/workloadIdentityPools/freenetorg-pool/providers/github'
service_account: 'gke-service-acct@freenet-353920.iam.gserviceaccount.com'
- name: Login to Google Artifact Registry
uses: docker/login-action@v2
with:
registry: us-east1-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- name: Clean Artifact Registry
uses: 'docker://us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli'
with:
args: >-
-repo=us-east1-docker.pkg.dev/freenet-353920/freenet-repo/freenet-org-production
-repo=us-east1-docker.pkg.dev/freenet-353920/freenet-repo/freenet-org
-repo=us-east1-docker.pkg.dev/freenet-353920/freenet-repo/freenet-org-staging
-keep=3
-tag-filter-any="^[a-zA-Z0-9_]*$"