Fix CI: delete existing release before creating a new one
All checks were successful
Release / build-and-release (push) Successful in 26m38s

Prevents "Release has no Tag" error when re-running a build for
a tag that already has a release.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
le king fu 2026-03-01 12:38:08 -05:00
parent e3992298f0
commit c777dbb7b8

View file

@ -152,6 +152,17 @@ jobs:
**Windows** : Téléchargez le fichier \`.exe\` ci-dessous. **Windows** : Téléchargez le fichier \`.exe\` ci-dessous.
**Linux** : Téléchargez le fichier \`.deb\` ou \`.AppImage\` ci-dessous." **Linux** : Téléchargez le fichier \`.deb\` ou \`.AppImage\` ci-dessous."
# Delete existing release for this tag (if any) to allow re-creation
EXISTING=$(curl -s "${API_URL}/repos/${REPO}/releases/tags/${TAG}" \
-H "Authorization: token ${FORGEJO_TOKEN}")
EXISTING_ID=$(echo "$EXISTING" | jq -r '.id // empty')
if [ -n "$EXISTING_ID" ]; then
echo "Deleting existing release ID: $EXISTING_ID"
curl -s -X DELETE \
"${API_URL}/repos/${REPO}/releases/${EXISTING_ID}" \
-H "Authorization: token ${FORGEJO_TOKEN}"
fi
# Create release # Create release
RELEASE_RESPONSE=$(curl -s -X POST \ RELEASE_RESPONSE=$(curl -s -X POST \
"${API_URL}/repos/${REPO}/releases" \ "${API_URL}/repos/${REPO}/releases" \