fix(ci): replace jq with python3 in release step, add debug output
All checks were successful
Beta Release / beta (push) Successful in 40s

💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
This commit is contained in:
Augustin
2026-04-23 23:13:03 +02:00
parent 8c540eba93
commit 7ae4017672

View File

@@ -183,25 +183,25 @@ jobs:
env: env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: | run: |
set -ex
if [ -z "$GITEA_TOKEN" ]; then if [ -z "$GITEA_TOKEN" ]; then
echo "Error: GITEA_TOKEN secret is not set" echo "Error: GITEA_TOKEN secret is not set"
exit 1 exit 1
fi fi
VERSION=${{ steps.version.outputs.version }} VERSION=${{ steps.version.outputs.version }}
API="${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases" API="${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases"
echo "=== Debug ==="
echo "GITEA_TOKEN length: ${#GITEA_TOKEN}"
echo "API endpoint: ${API}"
echo "Creating release ${VERSION} at ${API}" echo "Creating release ${VERSION} at ${API}"
EXISTING_ID=$(curl -s -H "Authorization: token ${GITEA_TOKEN}" "${API}/tags/${VERSION}" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*') EXISTING=$(curl -sf -H "Authorization: token ${GITEA_TOKEN}" "${API}/tags/${VERSION}" || echo "")
if [ -n "$EXISTING_ID" ]; then if [ -n "$EXISTING" ]; then
echo "Release ${VERSION} already exists (ID: ${EXISTING_ID}), deleting..." EXISTING_ID=$(echo "$EXISTING" | python3 -c "import sys,json; print(json.load(sys.stdin).get('id',''))" 2>/dev/null || echo "")
curl -s -X DELETE -H "Authorization: token ${GITEA_TOKEN}" "${API}/${EXISTING_ID}" if [ -n "$EXISTING_ID" ]; then
echo "Deleted existing release" echo "Release ${VERSION} already exists (ID: ${EXISTING_ID}), deleting..."
curl -sf -X DELETE -H "Authorization: token ${GITEA_TOKEN}" "${API}/${EXISTING_ID}" || true
fi
fi fi
BODY=$(cat /tmp/stable_changelog.md) BODY=$(python3 -c "import json,sys; print(json.dumps(sys.stdin.read()))" < /tmp/stable_changelog.md)
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "${API}" \ RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "${API}" \
-H "Authorization: token ${GITEA_TOKEN}" \ -H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
@@ -209,7 +209,7 @@ jobs:
\"tag_name\":\"${VERSION}\", \"tag_name\":\"${VERSION}\",
\"target_commitish\":\"main\", \"target_commitish\":\"main\",
\"name\":\"muyue ${VERSION}\", \"name\":\"muyue ${VERSION}\",
\"body\":$(echo "$BODY" | jq -Rs .), \"body\":${BODY},
\"draft\":false, \"draft\":false,
\"prerelease\":false \"prerelease\":false
}") }")
@@ -217,7 +217,7 @@ jobs:
RESPONSE_BODY=$(echo "$RESPONSE" | sed '$d') RESPONSE_BODY=$(echo "$RESPONSE" | sed '$d')
echo "HTTP Status: ${HTTP_CODE}" echo "HTTP Status: ${HTTP_CODE}"
echo "Response: ${RESPONSE_BODY}" echo "Response: ${RESPONSE_BODY}"
RELEASE_ID=$(echo "$RESPONSE_BODY" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*') RELEASE_ID=$(echo "$RESPONSE_BODY" | python3 -c "import sys,json; print(json.load(sys.stdin).get('id',''))" 2>/dev/null || echo "")
if [ -z "$RELEASE_ID" ]; then if [ -z "$RELEASE_ID" ]; then
echo "Failed to create release" echo "Failed to create release"
exit 1 exit 1