ci: delete existing release before recreating on retrigger
Release / release (push) Successful in 1m32s
Release / release (push) Successful in 1m32s
Prevents curl exit 22 (HTTP 409) when a tag's release already exists. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -41,11 +41,20 @@ jobs:
|
||||
id: create_release
|
||||
run: |
|
||||
TAG="${{ github.ref_name }}"
|
||||
API="${{ github.server_url }}/api/v1/repos/${{ github.repository }}"
|
||||
AUTH="Authorization: token ${{ secrets.GITEA_TOKEN }}"
|
||||
|
||||
# Delete existing release for this tag if present
|
||||
EXISTING=$(curl -sf -H "$AUTH" "$API/releases/tags/$TAG" | python3 -c "import sys,json; print(json.load(sys.stdin).get('id',''))" 2>/dev/null || true)
|
||||
if [ -n "$EXISTING" ]; then
|
||||
echo "Deleting existing release $EXISTING"
|
||||
curl -sf -X DELETE -H "$AUTH" "$API/releases/$EXISTING"
|
||||
fi
|
||||
|
||||
RELEASE=$(curl -sf -X POST \
|
||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||
-H "$AUTH" \
|
||||
-H "Content-Type: application/json" \
|
||||
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases" \
|
||||
"$API/releases" \
|
||||
-d "{
|
||||
\"tag_name\": \"$TAG\",
|
||||
\"name\": \"$TAG\",
|
||||
|
||||
Reference in New Issue
Block a user