fix: make Gitea release step idempotent in workflow
Build and Release Plugin / release (push) Successful in 34s

This commit is contained in:
2026-09-17 21:05:29 +02:00
parent 322cfd9acd
commit 13f9fd642c
+12 -8
View File
@@ -58,22 +58,26 @@ jobs:
IS_PRERELEASE="true" IS_PRERELEASE="true"
fi fi
# Create Release # Check if release exists
RELEASE_RES=$(curl -s -X POST "$API_URL/repos/$REPO/releases" \ EXISTING_REL=$(curl -s -H "Authorization: token $TOKEN" "$API_URL/repos/$REPO/releases/tags/$TAG")
-H "Authorization: token $TOKEN" \ REL_ID=$(echo "$EXISTING_REL" | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2)
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"$TAG\", \"name\":\"Release $TAG\", \"body\":\"Automated release\", \"draft\":false, \"prerelease\":$IS_PRERELEASE}")
REL_ID=$(echo "$RELEASE_RES" | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2) if [ -z "$REL_ID" ] || [ "$REL_ID" == "null" ]; then
RELEASE_RES=$(curl -s -X POST "$API_URL/repos/$REPO/releases" \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"$TAG\", \"name\":\"Release $TAG\", \"body\":\"Automated release\", \"draft\":false, \"prerelease\":$IS_PRERELEASE}")
REL_ID=$(echo "$RELEASE_RES" | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2)
fi
# Upload Assets # Upload Assets
curl -s -X POST "$API_URL/repos/$REPO/releases/$REL_ID/assets" \ curl -s -X POST "$API_URL/repos/$REPO/releases/$REL_ID/assets" \
-H "Authorization: token $TOKEN" \ -H "Authorization: token $TOKEN" \
-F "attachment=@BlackBarRemover_${TAG}_jf10.11.zip" -F "attachment=@BlackBarRemover_${TAG}_jf10.11.zip" || true
curl -s -X POST "$API_URL/repos/$REPO/releases/$REL_ID/assets" \ curl -s -X POST "$API_URL/repos/$REPO/releases/$REL_ID/assets" \
-H "Authorization: token $TOKEN" \ -H "Authorization: token $TOKEN" \
-F "attachment=@BlackBarRemover_${TAG}_jf12.0.zip" -F "attachment=@BlackBarRemover_${TAG}_jf12.0.zip" || true
- name: Update manifest.json - name: Update manifest.json
run: | run: |