DOCR - Cleanup Container Images #106
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: DOCR - Cleanup Container Images | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '5 0 * * 3,6' # 12:05 UTC on Wednesdays and Saturdays (6 hour maintenance window) | |
jobs: | |
remove: | |
name: Delete Old Images | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
repos: | |
- english | |
- chinese | |
- espanol | |
- italian | |
- japanese | |
- korean | |
- portuguese | |
- ukrainian | |
variants: | |
# - dev | |
- org | |
# Exclude the following combinations | |
exclude: | |
- repos: english | |
variants: dev | |
steps: | |
- name: Install doctl | |
uses: digitalocean/action-doctl@v2 | |
with: | |
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | |
- name: Log in to DigitalOcean Container Registry with short-lived credentials | |
run: doctl registry login --expiry-seconds 1200 | |
- name: Delete Images | |
uses: raisedadead/action-docr-cleanup@latest | |
with: | |
repository_name: '${{ matrix.variants }}/news-${{ matrix.repos }}' | |
days: '4' | |
clean: | |
name: Do Garbage Collection | |
runs-on: ubuntu-latest | |
needs: remove | |
steps: | |
- name: Install doctl | |
uses: digitalocean/action-doctl@v2 | |
with: | |
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | |
- name: Log in to DigitalOcean Container Registry with short-lived credentials | |
run: doctl registry login --expiry-seconds 1200 | |
- name: Trigger Garbage collection | |
run: doctl registry garbage-collection start --include-untagged-manifests --force |