Skip to content

Commit a0ea293

Browse files
committed
Customize GH release notes & add tarball
I wasn't extremely happy with the default github-generated release notes, specifically the changelog tag detection, so I used the suggestions I found in the softprops repo: mikepenz's release-changelog-builder-action. Added .github/changelog.json to customize the labels, categories, and output templates for the release notes. For it to work how I'd like, I had to manually construct the compare link from the action's detected tags and manually construct the NPM package url. Also had to add a manual npm pack step in order to provide the .tgz in the GitHub release assets, but that can be removed if desired.
1 parent 5336d15 commit a0ea293

File tree

2 files changed

+48
-3
lines changed

2 files changed

+48
-3
lines changed

.github/changelog.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"categories": [
3+
{
4+
"title": "## ⚙️ Breaking",
5+
"labels": ["breaking"]
6+
},
7+
{
8+
"title": "## 🚀 Features",
9+
"labels": ["feature", "enhancement"]
10+
},
11+
{
12+
"title": "## 🐛 Fixes",
13+
"labels": ["fix", "bugfix"]
14+
},
15+
{
16+
"title": "## 📜 Documentation",
17+
"labels": ["documentation", "docs"]
18+
},
19+
{
20+
"title": "## 🛠️ Infrastructure",
21+
"labels": ["dependencies", "maintenance", "ci"]
22+
},
23+
{
24+
"title": "## 💬 Uncategorized",
25+
"labels": []
26+
}
27+
],
28+
"ignore_labels": ["ignore", "ci-ignore"],
29+
"template": "#{{CHANGELOG}}",
30+
"pr_template": "- #{{TITLE}} (##{{NUMBER}} by @#{{AUTHOR}})"
31+
}

.github/workflows/release.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,30 @@ jobs:
2424
- uses: JS-DevTools/npm-publish@v3
2525
with:
2626
token: ${{ secrets.NPM_TOKEN }}
27+
# see https://github.com/softprops/action-gh-release/pull/372#issuecomment-1642643937
28+
- name: Create release notes
29+
id: build_changelog
30+
uses: mikepenz/release-changelog-builder-action@v5
31+
with:
32+
configuration: '.github/changelog.json'
33+
ignorePreReleases: ${{ ! contains(github.ref_name, '-') }}
34+
- name: Create tarball
35+
run: npm pack --ignore-scripts
2736
- name: Create release
2837
id: create_release
2938
uses: softprops/action-gh-release@v2
3039
with:
3140
tag_name: ${{ github.ref }}
3241
name: Release ${{ github.ref_name }}
33-
body: ""
34-
generate_release_notes: true
42+
body: |
43+
${{ steps.build_changelog.outputs.changelog }}
44+
45+
**${{ contains(github.ref_name, '-') && 'Prerelease' || 'Full' }} changelog:** ${{ github.server_url }}/${{ github.repository }}/compare/${{ steps.build_changelog.outputs.fromTag }}...${{ steps.build_changelog.outputs.toTag }}
46+
**NPM release:** https://npmjs.com/package/${{ steps.publish.outputs.name }}/v/${{ steps.publish.outputs.version }}
3547
draft: true
36-
prerelease: false
48+
prerelease: ${{ contains(github.ref_name, '-') }}
49+
files: |
50+
*.tgz
3751
- name: action-slack
3852
uses: 8398a7/[email protected]
3953
with:

0 commit comments

Comments
 (0)