fix(ci): build release payload via heredoc, drop broken env-var passing
Release / release (push) Successful in 24s

Previous attempt used `python3 -c "..." KEY=VALUE` which passes
KEY=VALUE as positional args, not environment variables — the python
block then crashed with KeyError: 'BODY' because nothing actually set
it in the environment.

Consolidate into a single heredoc-fed python3 block that reads
RELEASE_NOTES from the already-exported env var and reads TAG/VERSION/
IS_PRE after an explicit `export`. Uses <<'PY' so shell metachars in
the Python source (backticks, $, quotes) are not interpreted.

Also drops the redundant intermediate BODY variable — body is built
directly inside the single python invocation.
This commit is contained in:
2026-04-21 20:16:27 +03:00
parent e12820f150
commit f27fa42b87
+8 -12
View File
@@ -94,7 +94,9 @@ jobs:
echo "No RELEASE_NOTES.md found"
fi
BODY=$(python3 -c "
# Build release payload (avoids shell escaping & CLI length limits)
export TAG VERSION IS_PRE
python3 <<'PY'
import json, os
release_notes = os.environ.get('RELEASE_NOTES', '')
@@ -106,22 +108,16 @@ jobs:
if changelog:
sections.append('## Changelog\n\n' + changelog)
print(json.dumps('\n\n'.join(sections)))
")
# Send body via file to avoid CLI length limits / shell escaping
python3 -c "
import json, os
body = os.environ['BODY']
payload = {
'tag_name': os.environ['TAG'],
'name': f\"Notify Bridge {os.environ['VERSION']}\",
'body': json.loads(body),
'name': f"Notify Bridge {os.environ['VERSION']}",
'body': '\n\n'.join(sections),
'draft': False,
'prerelease': os.environ['IS_PRE'] == 'true',
}
open('/tmp/release-payload.json','w').write(json.dumps(payload))
" BODY="$BODY" TAG="$TAG" VERSION="$VERSION" IS_PRE="$IS_PRE"
with open('/tmp/release-payload.json', 'w') as f:
json.dump(payload, f)
PY
HTTP=$(curl -s -o /tmp/release-resp.json -w "%{http_code}" \
-X POST "$BASE_URL/releases" \