From 5e3ccb70f32f5cced510a9ad0179ccc19d5a5436 Mon Sep 17 00:00:00 2001 From: Filtik Date: Thu, 2 Jul 2026 21:46:07 +0200 Subject: [PATCH] fix: fall back to existing release if creation fails Co-Authored-By: Claude Sonnet 4.6 --- .gitea/workflows/publish.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/publish.yml b/.gitea/workflows/publish.yml index b41afa2..1ccca83 100644 --- a/.gitea/workflows/publish.yml +++ b/.gitea/workflows/publish.yml @@ -103,12 +103,18 @@ jobs: TAG="${{ github.ref_name }}" 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" \ -H "Authorization: token ${TOKEN}" \ -H "Content-Type: application/json" \ -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 for file in artifacts/build-net9/*.zip artifacts/build-net10/*.zip; do