diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 8880d41..4f04444 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -60,6 +60,23 @@ jobs: helm registry login registry.digitalocean.com -u token --password "${{ secrets.DOCR_TOKEN }}" helm package chart/ helm push lunarfront-$VERSION.tgz oci://registry.digitalocean.com/lunarfront + # Remove untagged manifests left by helm push (OCI index artifacts) + curl -s "https://api.digitalocean.com/v2/registry/lunarfront/repositories/lunarfront/tags?per_page=100" \ + -H "Authorization: Bearer ${{ secrets.DOCR_TOKEN }}" | \ + python3 -c " + import sys, json, urllib.request + data = json.load(sys.stdin) + token = '${{ secrets.DOCR_TOKEN }}' + for tag in data.get('tags', []): + if not tag['tag']: + digest = tag['manifest_digest'] + req = urllib.request.Request( + f'https://api.digitalocean.com/v2/registry/lunarfront/repositories/lunarfront/digests/{digest}', + method='DELETE', headers={'Authorization': f'Bearer {token}'} + ) + try: urllib.request.urlopen(req) + except: pass + " - name: Logout if: always()