From 82cd8940c2c9da1538a40a23ea9ce96f60c7f4c0 Mon Sep 17 00:00:00 2001 From: Story Crater Bot <19826264+Riotpiaole@users.noreply.github.com> Date: Wed, 2 Sep 2026 09:58:34 -0700 Subject: [PATCH] fix: delete old latest image before rebuild, use --no-cache for fresh builds --- .gitea/workflows/build-push.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/build-push.yml b/.gitea/workflows/build-push.yml index 6dfe2f8..35d69c8 100644 --- a/.gitea/workflows/build-push.yml +++ b/.gitea/workflows/build-push.yml @@ -39,9 +39,20 @@ jobs: REGISTRY_USER: ${{ secrets.FORGEJO_REGISTRY_USER }} REGISTRY_TOKEN: ${{ secrets.FORGEJO_REGISTRY_TOKEN }} + - name: Delete old latest image + run: | + # Delete old :latest tag from Forgejo registry via API + curl -s -X DELETE \ + -u "${REGISTRY_USER}:${REGISTRY_TOKEN}" \ + "https://${REGISTRY}/v2/rock/portfolio/manifests/$(curl -s -H 'Accept: application/vnd.oci.image.index.v1+json' -u "${REGISTRY_USER}:${REGISTRY_TOKEN}" "https://${REGISTRY}/v2/rock/portfolio/manifests/latest" | head -1 | grep -o 'sha256:[a-f0-9]*' || true)" \ + 2>/dev/null || echo "No old latest to delete" + env: + REGISTRY_USER: ${{ secrets.FORGEJO_REGISTRY_USER }} + REGISTRY_TOKEN: ${{ secrets.FORGEJO_REGISTRY_TOKEN }} + - name: Build image run: | - docker build \ + docker build --no-cache \ -t "${IMAGE}:${{ steps.sha.outputs.short_sha }}" \ -t "${IMAGE}:latest" \ .