fix: fall back to existing release if creation fails
Publish Release / build-net9 (push) Successful in 58s Details
Publish Release / build-net10 (push) Successful in 1m1s Details
Publish Release / release (push) Successful in 13s Details

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Filtik 2026-07-02 21:46:07 +02:00
parent 1d27e351ca
commit 5e3ccb70f3
1 changed files with 8 additions and 2 deletions

View File

@ -103,12 +103,18 @@ jobs:
TAG="${{ github.ref_name }}" TAG="${{ github.ref_name }}"
TOKEN="${{ secrets.GITHUB_TOKEN }}" TOKEN="${{ secrets.GITHUB_TOKEN }}"
# Create release (or get existing) # Create release, fall back to existing if already present
RELEASE=$(curl -s -X POST "${API}/repos/${REPO}/releases" \ RELEASE=$(curl -s -X POST "${API}/repos/${REPO}/releases" \
-H "Authorization: token ${TOKEN}" \ -H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "{\"tag_name\":\"${TAG}\",\"name\":\"${TAG}\"}") -d "{\"tag_name\":\"${TAG}\",\"name\":\"${TAG}\"}")
RELEASE_ID=$(echo "${RELEASE}" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])") RELEASE_ID=$(echo "${RELEASE}" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])" 2>/dev/null)
if [ -z "${RELEASE_ID}" ]; then
RELEASE=$(curl -s "${API}/repos/${REPO}/releases/tags/${TAG}" \
-H "Authorization: token ${TOKEN}")
RELEASE_ID=$(echo "${RELEASE}" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")
fi
echo "Release ID: ${RELEASE_ID}"
# Upload assets # Upload assets
for file in artifacts/build-net9/*.zip artifacts/build-net10/*.zip; do for file in artifacts/build-net9/*.zip artifacts/build-net10/*.zip; do