This commit is contained in:
@@ -211,28 +211,28 @@ jobs:
|
||||
run: |
|
||||
TAG_NAME="v${{ steps.version.outputs.VERSION }}"
|
||||
RELEASE_NAME="${{ steps.version.outputs.REPO_NAME }} v${{ steps.version.outputs.VERSION }}"
|
||||
BODY="### Changelog\nFiles changed in this release:\n${{ steps.changed_files.outputs.CHANGED }}"
|
||||
# Construct Markdown body with real newlines
|
||||
BODY="$(printf "### Changelog\nFiles changed in this release:\n%s" "${{ steps.changed_files.outputs.CHANGED }}")"
|
||||
|
||||
# Create JSON payload using jq to ensure proper escaping
|
||||
jq -n \
|
||||
--arg tag_name "$TAG_NAME" \
|
||||
--arg name "$RELEASE_NAME" \
|
||||
--arg body "$BODY" \
|
||||
'{tag_name: $tag_name, name: $name, body: $body, draft: false, prerelease: false}' > release_payload.json
|
||||
|
||||
# Create Release
|
||||
RESPONSE=$(curl -s -X POST "${{ gitea.api_url }}/repos/${{ gitea.repository }}/releases" \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d @- <<EOF
|
||||
{
|
||||
"tag_name": "$TAG_NAME",
|
||||
"name": "$RELEASE_NAME",
|
||||
"body": $(jq -n --arg body "$BODY" '$body'),
|
||||
"draft": false,
|
||||
"prerelease": false
|
||||
}
|
||||
EOF
|
||||
)
|
||||
-d @release_payload.json)
|
||||
|
||||
RELEASE_ID=$(echo "$RESPONSE" | jq -r .id)
|
||||
echo "RELEASE_ID=$RELEASE_ID" >> "$GITHUB_OUTPUT"
|
||||
|
||||
if [ "$RELEASE_ID" == "null" ]; then
|
||||
echo "Failed to create release: $RESPONSE"
|
||||
echo "Failed to create release. Response:"
|
||||
echo "$RESPONSE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user