8787 - name : Generate Changelog
8888 run : bun run changelog
8989
90+ - name : Prepare release notes
91+ run : |
92+ # Extract the newest section from CHANGELOG.md (between the first two
93+ # version headers produced by conventional-changelog).
94+ awk '
95+ /^#{1,3} \[?[0-9]+\.[0-9]+\.[0-9]+/ { count++ }
96+ count == 1 { print }
97+ count == 2 { exit }
98+ ' CHANGELOG.md > CHANGES_SECTION.md
99+
100+ {
101+ echo "## 🚀 Release ${{ steps.version.outputs.version }}"
102+ echo ""
103+ echo "**Release type:** \`${{ inputs.release-type }}\` · **Dist tag:** \`${{ inputs.dist-tag }}\`"
104+ echo ""
105+ echo "### Install"
106+ echo '```bash'
107+ echo "npm install moicle@${{ steps.version.outputs.version }}"
108+ echo '```'
109+ echo ""
110+ if [ -s CHANGES_SECTION.md ]; then
111+ # Drop the duplicated version header line, keep the grouped changes.
112+ tail -n +2 CHANGES_SECTION.md
113+ fi
114+ } > RELEASE_NOTES.md
115+
116+ echo "----- Release notes preview -----"
117+ cat RELEASE_NOTES.md
118+
90119 - name : Publish to NPM
91120 run : |
92121 if [ "${{ inputs.dist-tag }}" == "latest" ]; then
@@ -112,24 +141,15 @@ jobs:
112141 git push origin ${{ steps.version.outputs.tag }}
113142
114143 - name : Create GitHub Release
115- uses : actions/create- release@v1
144+ uses : softprops/action-gh- release@v2
116145 env :
117146 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
118147 with :
119148 tag_name : ${{ steps.version.outputs.tag }}
120- release_name : Release ${{ steps.version.outputs.version }}
121- body : |
122- ## 🚀 Release ${{ steps.version.outputs.version }}
123-
124- **Release Type:** ${{ inputs.release-type }}
125- **Dist Tag:** ${{ inputs.dist-tag }}
126-
127- ### Installation
128- ```bash
129- npm install moicle@${{ steps.version.outputs.version }}
130- ```
131-
132- ### Changes
133- See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/master/CHANGELOG.md) for details.
149+ name : Release ${{ steps.version.outputs.version }}
150+ # body_path is prepended; generate_release_notes appends GitHub's
151+ # auto "What's Changed" + contributors list below it.
152+ body_path : RELEASE_NOTES.md
153+ generate_release_notes : true
134154 draft : false
135155 prerelease : ${{ inputs.dist-tag != 'latest' }}
0 commit comments