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
23 changes: 20 additions & 3 deletions .github/workflows/dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,27 @@ jobs:
with:
name: dist
path: dist
- uses: softprops/action-gh-release@v2
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
latest_release_tag=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases \
| jq -r 'sort_by(.created_at) | last(.[]).tag_name')
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/releases \
-d '{
"tag_name": "${{ github.ref_name }}",
"previous_tag_name": "${latest_release_tag}",
"prerelease": ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }},
"generate_release_notes": true
}'
Comment on lines +133 to +139
Copy link
Contributor

Choose a reason for hiding this comment

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

I went through the official docs and didn't found parameter previous_tag_name for Create a release endpoint. So it seems, even if generate_release_notes is set to true, the previous_tag_name plays no role.

The parameter previous_tag_name exists for generate release notes endpoint. This endpoint will return the name and body according to specified parameters, which could be then used to create a release using create a release endpoint

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nonetheless it works fine.

It seems that "generate_release_notes": true internally triggers the "generate release notes" endpoint as well, which uses previous_tag_name.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will check again.

- name: Create release assets
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
files: |
dist/*
upstream/*
Expand Down
Loading