ci(release): keep the release payload valid JSON
VoidBuildSystem CI / 4A2 · VBS installers (linux target) (push) Successful in 3m2s
VoidBuildSystem CI / 1 · Requirements (push) Successful in 5s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 4m59s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 5m4s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 5m44s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Successful in 6m21s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Successful in 6m16s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 1m10s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 1m47s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 3m16s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 19s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 18s
VoidBuildSystem CI / 4A2 · VBS installers (windows target) (push) Successful in 3m3s
VoidBuildSystem CI / 5 · Release (push) Skipped

The release body embedded literal newlines, so the create-release POST
was rejected; it only ever worked because an existing release was
found by tag. Escape the newlines, validate the payload, and print the
server responses when no release id can be resolved.
This commit is contained in:
faumaray committed 2026-12-06 15:10:45 +03:00
1 parent 6fe31ebf56
commit 6b9074241f
1 file changed
+9 -2
+9 -2
View File
@@ -475,9 +475,11 @@ jobs:
(cd dist && sha256sum ./* > SHA256SUMS)
ls -l dist/
api="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
body="$(printf 'Release %s\n\nBuilt from %s with the full CTest suite green.\nSee SHA256SUMS for artifact digests.' "${tag}" "${GITHUB_SHA}")"
# Escaped newlines: the payload must stay valid JSON.
body="$(printf 'Release %s\\n\\nBuilt from %s with the full CTest suite green.\\nSee SHA256SUMS for artifact digests.' "${tag}" "${GITHUB_SHA}")"
payload="$(printf '{"tag_name":"%s","name":"%s","body":"%s","draft":false,"prerelease":false}' \
"${tag}" "${tag}" "${body}")"
printf '%s' "${payload}" | python3 -c 'import json,sys; json.load(sys.stdin)'
extract_id() {
python3 -c 'import json,sys; s=sys.stdin.read().strip(); print(json.loads(s).get("id","") if s else "")' 2>/dev/null || true
}
@@ -490,7 +492,12 @@ jobs:
"${api}/releases/tags/${tag}" || true)"
release_id="$(printf '%s' "${existing}" | extract_id)"
fi
test -n "${release_id}"
if [ -z "${release_id}" ]; then
echo "could not create or find the release for ${tag}:" >&2
echo "create: ${created}" >&2
echo "lookup: ${existing:-<none>}" >&2
exit 1
fi
for file in dist/*; do
name="$(basename "${file}")"
curl -fsS -X POST -H "Authorization: token ${TOKEN}" \