Skip to content

Commit 67fe542

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

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

.github/workflows/dist.yml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,33 @@ jobs:
133133
name: dist
134134
path: dist
135135

136-
- name: Create release assets
137-
uses: softprops/action-gh-release@v2
138-
with:
139-
files: |
140-
dist/*
141-
upstream/*
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+
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' > release_notes
152+
153+
      - name: Create release
154+
        uses: softprops/action-gh-release@v2
155+
        with:
156+
          body_path: release_notes
157+
          files: |
158+
            dist/*
159+
            upstream/*
160+
          tag_name: ${{ github.ref_name }}
161+
          prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
142162
token: ${{ secrets.RELEASE_CREATION_TOKEN }}
143-
generate_release_notes: true
144-
prerelease: ${{ contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }}
145163

146164
build_wheels:
147165
# Temporarily disabled due to build errors

0 commit comments

Comments
 (0)