You've already forked wp-fedistream
fix(ci): Handle existing releases when re-releasing
All checks were successful
Create Release Package / build-release (push) Successful in 50s
All checks were successful
Create Release Package / build-release (push) Successful in 50s
- Check if release already exists for the tag - Delete existing release before creating new one - Allows re-releasing the same version after fixes Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -161,6 +161,21 @@ jobs:
|
|||||||
# Read release notes
|
# Read release notes
|
||||||
BODY=$(cat release_notes.txt)
|
BODY=$(cat release_notes.txt)
|
||||||
|
|
||||||
|
# Check if release already exists for this tag
|
||||||
|
EXISTING_RELEASE=$(curl -s \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/tags/${TAG_NAME}")
|
||||||
|
|
||||||
|
EXISTING_ID=$(echo "$EXISTING_RELEASE" | jq -r '.id // empty')
|
||||||
|
|
||||||
|
if [ -n "$EXISTING_ID" ] && [ "$EXISTING_ID" != "null" ]; then
|
||||||
|
echo "Release already exists for tag ${TAG_NAME} (ID: $EXISTING_ID). Deleting..."
|
||||||
|
curl -s -X DELETE \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${EXISTING_ID}"
|
||||||
|
echo "Deleted existing release."
|
||||||
|
fi
|
||||||
|
|
||||||
# Create release via Gitea API
|
# Create release via Gitea API
|
||||||
RELEASE_RESPONSE=$(curl -s -X POST \
|
RELEASE_RESPONSE=$(curl -s -X POST \
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
|||||||
Reference in New Issue
Block a user