fix: fall back to existing release if creation fails
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1d27e351ca
commit
5e3ccb70f3
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue