Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

build: add workflow to cleanup old DOCR images #318

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/docr-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
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
environment: staging
strategy:
fail-fast: false
matrix:
repos:
- backend
- frontend
- cron
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 }}/publish-${{ matrix.repos }}'
days: '4'
dry_run: 'true'

# clean:
# name: Do Garbage Collection
# runs-on: ubuntu-latest
# environment: staging
# 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