diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..60cc0eb --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,43 @@ +on: + release: + types: + - published + +name: release + +jobs: + readme-changelog: + name: Publish changelog to Readme + runs-on: ubuntu-latest + steps: + - name: Extract release data + id: release + run: | + echo "title=${{ github.event.release.name }}" >> $GITHUB_OUTPUT + { + echo "body<> $GITHUB_OUTPUT + + - 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 "Node.js Unified SDK v${{ steps.release.outputs.title }}" \ + --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 @payload.json \ No newline at end of file