diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 27b7c43..bee1eb0 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -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:-}" >&2 + exit 1 + fi for file in dist/*; do name="$(basename "${file}")" curl -fsS -X POST -H "Authorization: token ${TOKEN}" \