Skip to content

Commit b47b032

Browse files
committed
Create release just once
1 parent 28b7af0 commit b47b032

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

.github/workflows/dist.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,32 @@ jobs:
133133
name: dist
134134
path: dist
135135

136-
- name: Create release assets
136+
- name: Create release notes
137+
env:
138+
GITHUB_PAT: ${{ secrets.RELEASE_CREATION_TOKEN }}
139+
run: |
140+
latest_release_tag=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases \
141+
| jq -r 'sort_by(.created_at) | last(.[]).tag_name')
142+
release_notes=$(curl -s \
143+
-X POST \
144+
-H "Accept: application/vnd.github+json" \
145+
-H "Authorization: Bearer $GITHUB_PAT" \
146+
-H "X-GitHub-Api-Version: 2022-11-28" \
147+
https://api.github.com/repos/${{ github.repository }}/releases/generate-notes \
148+
-d "{
149+
\"tag_name\": \"${{ github.ref_name }}\",
150+
\"previous_tag_name\": \"$latest_release_tag\"
151+
}" | jq -r '.body')
152+
echo "$release_notes" > release_notes
153+
154+
- name: Create release
137155
uses: softprops/action-gh-release@v2
138156
with:
139157
files: |
140158
dist/*
141159
upstream/*
142160
token: ${{ secrets.RELEASE_CREATION_TOKEN }}
143-
generate_release_notes: true
161+
body_path: release_notes
144162
prerelease: ${{ contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }}
145163

146164
build_wheels:

0 commit comments

Comments
 (0)