fix(ci): delete existing package before PUT to avoid 409

Gitea generic packages returns 409 if file already exists at same
version. Delete the version first, then re-upload.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Cinco Euzebio 2026-02-28 23:17:56 -03:00
parent e6180b57c3
commit c1adc92c1c

View File

@ -31,6 +31,9 @@ steps:
else FILL="#e05d44"; fi
echo "PCT=$PCT FILL=$FILL"
printf '<svg xmlns="http://www.w3.org/2000/svg" width="120" height="20"><rect width="76" height="20" fill="#555"/><rect x="76" width="44" height="20" fill="%s"/><g fill="#fff" text-anchor="middle" font-family="sans-serif" font-size="11"><text x="38" y="14">coverage</text><text x="98" y="14">%s%%</text></g></svg>' "$FILL" "$PCT" > coverage.svg
curl -s -X DELETE \
-H "Authorization: token $GITEA_TOKEN" \
"https://git.cincoeuzebio.com/api/v1/packages/cinco/generic/badges/latest" || true
curl -fsSL -X PUT \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: image/svg+xml" \