ci: include changelog in release body
Release / Build & Release (push) Successful in 18m31s

This commit is contained in:
god
2026-07-04 22:59:49 +08:00
parent 260a448a70
commit a2d008a480
+16 -1
View File
@@ -69,6 +69,19 @@ jobs:
mv build/macos/tekton_armageddon_macos.zip build/tekton_armageddon_macos_${TAG_NAME}.zip
fi
- name: Extract changelog
run: |
# Extract changelog for this tag version from CHANGELOG_DRAFT.md
V="${TAG_NAME#v}"
BODY=$(awk -v ver="[$V]" '
/^## / { if (found) exit }
/^## / && index($0, ver) { found=1; next }
found { print }
' CHANGELOG_DRAFT.md | sed 's/^ *//')
echo "CHANGELOG_BODY<<EOF" >> $GITHUB_ENV
echo "$BODY" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create Gitea Release
run: |
set -e
@@ -79,10 +92,12 @@ jobs:
RELEASE_ID=$(echo "$RELEASE_JSON" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*' || true)
if [ -z "$RELEASE_ID" ]; then
echo "Creating new release for $TAG..."
# Escape body for JSON
BODY_ESCAPED=$(echo "$CHANGELOG_BODY" | python3 -c "import json,sys; print(json.dumps(sys.stdin.read().strip()))" 2>/dev/null || echo '""')
RELEASE_JSON=$(curl -s -X POST \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"draft\":true}" \
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"body\":$BODY_ESCAPED,\"draft\":true}" \
"$API")
echo "API response: $RELEASE_JSON"
RELEASE_ID=$(echo "$RELEASE_JSON" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*')