Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,31 @@ jobs:
- name: Extract release data
id: release
run: |
echo "title=$(echo "${{ github.event.release.name }}" | sed 's/"/\\"/g')" >> $GITHUB_OUTPUT
echo "body=$(echo "${{ github.event.release.body }}" | sed ':a;N;$!ba;s/\n/\\n/g' | sed 's/"/\\"/g')" >> $GITHUB_OUTPUT
echo "title=${{ github.event.release.name }}" >> $GITHUB_OUTPUT
{
echo "body<<EOF"
echo "${{ github.event.release.body }}"
echo "EOF"
} >> $GITHUB_OUTPUT
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass values to next step


- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq

- name: Publish changelog to Readme
env:
README_API_KEY: ${{ secrets.README_API_KEY }}
run: |
jq -n --arg title "Python Unified SDK ${{ steps.release.outputs.title }}" \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use jq to build the JSON we send

--arg body "${{ steps.release.outputs.body }}" \
'{
title: $title,
content: {
body: $body
},
privacy: { view: "public" }
}' > payload.json

curl --location 'https://api.readme.com/v2/changelogs' \
--header "Authorization: Bearer $README_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"body": "${{ steps.release.outputs.body }}",
"title": "Python Unified SDK ${{ steps.release.outputs.title }}",
"privacy": {
"view": "public"
}
}'
--header "Authorization: Bearer $README_API_KEY" \
--header 'Content-Type: application/json' \
--data @payload.json