Handle existing releases gracefully, validate release IDs
Build and Release / build-amd64 (push) Failing after 2m59s
Build and Release / build-arm64 (push) Has been skipped

This commit is contained in:
marauder-actual
2026-06-12 17:51:16 +02:00
parent 5729d0e5ae
commit 4ad2743f8a
+20 -1
View File
@@ -36,7 +36,16 @@ jobs:
DEB=$(ls build/*.deb)
FILENAME=$(basename "${DEB}")
# Create release (ignore conflict if exists)
# Delete existing release for this tag if any
OLD_ID=$(curl -s -H "Authorization: token ${TOKEN}" \
"${API}/repos/${REPO}/releases/tags/${TAG}" | jq -r '.id // empty')
if [ -n "${OLD_ID}" ] && [ "${OLD_ID}" != "null" ]; then
echo "Deleting existing release ${OLD_ID}..."
curl -s -X DELETE -H "Authorization: token ${TOKEN}" \
"${API}/repos/${REPO}/releases/${OLD_ID}"
fi
# Create release
RELEASE_ID=$(curl -s -X POST \
-H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/json" \
@@ -44,6 +53,11 @@ jobs:
"${API}/repos/${REPO}/releases" | jq -r '.id')
echo "Release ID: ${RELEASE_ID}"
if [ -z "${RELEASE_ID}" ] || [ "${RELEASE_ID}" = "null" ]; then
echo "ERROR: Failed to create release"
exit 1
fi
# Attach amd64 deb
curl --fail -X POST \
-H "Authorization: token ${TOKEN}" \
@@ -88,6 +102,11 @@ jobs:
"${API}/repos/${REPO}/releases/tags/${TAG}" | jq -r '.id')
echo "Release ID: ${RELEASE_ID}"
if [ -z "${RELEASE_ID}" ] || [ "${RELEASE_ID}" = "null" ]; then
echo "ERROR: Release not found for tag ${TAG}"
exit 1
fi
# Attach arm64 deb
curl --fail -X POST \
-H "Authorization: token ${TOKEN}" \