Skip to content

chore(deps): lock file maintenance (#2370) #2574

chore(deps): lock file maintenance (#2370)

chore(deps): lock file maintenance (#2370) #2574

name: DigitalOcean Cleanup Images
on:
push:
branches:
- master
schedule:
- cron: "0 17 * * *"
workflow_dispatch:
jobs:
cleanup:
name: Cleanup Docker Images
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Install doctl 🌊
uses: digitalocean/action-doctl@v2.5.1
with:
token: ${{ secrets.DIGITALOCEAN_TOKEN }}
- name: Authenticate to DigitalOcean 🔐
run: doctl registry login --expiry-seconds 600
- name: Delete old images 🧹
run: |-
DIGESTS=$(doctl registry repository list-tags ${{ secrets. DIGITALOCEAN_APP_NAME }} -o json | jq -r "sort_by(.updated_at) | reverse | .[10:] | .[] | .manifest_digest" | tr '\n' ' ')
[[ -n "$DIGESTS" ]] && doctl registry repository delete-manifest --force ${{ secrets. DIGITALOCEAN_APP_NAME }} $DIGESTS
echo "Done"
- name: Run garbage collection 🗑
if: ${{ github.event_name == 'schedule' }}
run: |-
doctl registry garbage-collection start --include-untagged-manifests --force ${{ secrets.DIGITALOCEAN_REGISTRY }}