fix: escape release body via Python to avoid YAML parsing errors
All checks were successful
Lint & Test / test (push) Successful in 31s
Build Release / create-release (push) Successful in 1s
Build Release / build-linux (push) Successful in 1m14s
Build Release / build-docker (push) Successful in 7s
Build Release / build-windows (push) Successful in 2m41s

This commit is contained in:
2026-03-22 13:59:14 +03:00
parent 5c814a64a7
commit 52c8614a3c

View File

@@ -30,36 +30,38 @@ jobs:
REPO=$(echo "${{ gitea.repository }}" | tr '[:upper:]' '[:lower:]') REPO=$(echo "${{ gitea.repository }}" | tr '[:upper:]' '[:lower:]')
DOCKER_IMAGE="${SERVER_HOST}/${REPO}" DOCKER_IMAGE="${SERVER_HOST}/${REPO}"
# Build release body # Build release body via Python to avoid YAML escaping issues
BODY=$(cat <<BODY_EOF BODY_JSON=$(python3 -c "
## Downloads import json, sys
tag = '$TAG'
image = '$DOCKER_IMAGE'
body = f'''## Downloads
| Platform | File | Description | | Platform | File | Description |
|----------|------|-------------| |----------|------|-------------|
| Windows (installer) | \`LedGrab-${TAG}-setup.exe\` | Install with Start Menu shortcut, optional autostart, uninstaller | | Windows (installer) | \`LedGrab-{tag}-setup.exe\` | Install with Start Menu shortcut, optional autostart, uninstaller |
| Windows (portable) | \`LedGrab-${TAG}-win-x64.zip\` | Unzip anywhere run \`LedGrab.bat\` | | Windows (portable) | \`LedGrab-{tag}-win-x64.zip\` | Unzip anywhere, run LedGrab.bat |
| Linux | \`LedGrab-${TAG}-linux-x64.tar.gz\` | Extract run \`./run.sh\` | | Linux | \`LedGrab-{tag}-linux-x64.tar.gz\` | Extract, run ./run.sh |
| Docker | See below | \`docker pull\` → \`docker run\` | | Docker | See below | docker pull + docker run |
After starting, open **http://localhost:8080** in your browser. After starting, open **http://localhost:8080** in your browser.
### Docker ### Docker
\`\`\`bash \`\`\`bash
docker pull ${DOCKER_IMAGE}:${TAG} docker pull {image}:{tag}
docker run -d --name ledgrab -p 8080:8080 -v ledgrab-data:/app/data ${DOCKER_IMAGE}:${TAG} docker run -d --name ledgrab -p 8080:8080 -v ledgrab-data:/app/data {image}:{tag}
\`\`\` \`\`\`
### First-time setup ### First-time setup
1. Change the default API key in \`config/default_config.yaml\` or set \`WLED_AUTH__API_KEYS='["your-secret-key"]'\` 1. Change the default API key in config/default_config.yaml
2. Open http://localhost:8080 and discover your WLED devices 2. Open http://localhost:8080 and discover your WLED devices
3. See [INSTALLATION.md](INSTALLATION.md) for detailed configuration 3. See INSTALLATION.md for detailed configuration
BODY_EOF '''
) import textwrap
print(json.dumps(textwrap.dedent(body).strip()))
# Escape body for JSON ")
BODY_JSON=$(echo "$BODY" | python3 -c "import sys,json; print(json.dumps(sys.stdin.read()))")
RELEASE=$(curl -s -X POST "$BASE_URL/releases" \ RELEASE=$(curl -s -X POST "$BASE_URL/releases" \
-H "Authorization: token $GITEA_TOKEN" \ -H "Authorization: token $GITEA_TOKEN" \