Skip to content

Commit 619fc24

Browse files
authored
Merge pull request #126 from BitGo/WP-5644-custom-release-notes
build(gha): use semantic release changelog for gh release notes
2 parents 6f6d7a3 + 7766230 commit 619fc24

File tree

6 files changed

+15836
-10352
lines changed

6 files changed

+15836
-10352
lines changed

.commitlintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"header-max-length": [2, "always", 72],
66
"references-empty": [1, "never"],
77
"subject-case": [0],
8-
"scope-enum": [2, "always", ["mbe", "awm", "docker"]],
8+
"scope-enum": [2, "always", ["mbe", "awm", "docker", "gha"]],
99
"scope-empty": [0, "never"]
1010
},
1111
"parserPreset": {

.github/workflows/release-to-ghcr.yaml

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ jobs:
3232
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.commit_sha || github.sha }}
3333
fetch-depth: 0 # Fetch all history for git describe to work
3434

35+
- name: Setup Node.js
36+
uses: actions/setup-node@v4
37+
with:
38+
node-version: '22'
39+
40+
- name: Install dependencies
41+
run: npm ci
42+
3543
- name: Compute the context for this release
3644
id: compute-context
3745
run: |
@@ -77,6 +85,30 @@ jobs:
7785
release-id: ${{ steps.create-release.outputs.id }}
7886
release-url: ${{ steps.create-release.outputs.html_url }}
7987
steps:
88+
- name: Checkout
89+
uses: actions/checkout@v4
90+
with:
91+
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.commit_sha || github.sha }}
92+
fetch-depth: 0
93+
94+
- name: Setup Node.js
95+
uses: actions/setup-node@v4
96+
with:
97+
node-version: '22'
98+
99+
- name: Install dependencies
100+
run: npm ci
101+
102+
- name: Generate release notes
103+
id: generate-notes
104+
run: |
105+
# Generate release notes using the existing .releaserc.json configuration
106+
notes=$(npx semantic-release --dry-run --no-ci --plugins @semantic-release/release-notes-generator 2>/dev/null | grep -A 1000 "The release notes for this version" | tail -n +2 || echo "## What's Changed\n\nThis release includes various improvements and bug fixes.")
107+
108+
echo "notes<<EOF" >> $GITHUB_OUTPUT
109+
echo "$notes" >> $GITHUB_OUTPUT
110+
echo "EOF" >> $GITHUB_OUTPUT
111+
80112
- name: Create release
81113
id: create-release
82114
uses: actions/github-script@v7
@@ -87,14 +119,14 @@ jobs:
87119
repo: context.repo.repo,
88120
tag_name: `v${process.env.VERSION}`,
89121
name: `v${process.env.VERSION}`,
90-
body: 'Automated release created by GitHub Actions',
122+
body: process.env.RELEASE_NOTES,
91123
draft: false,
92-
prerelease: false,
93-
generate_release_notes: true
124+
prerelease: false
94125
});
95126
return release.data;
96127
env:
97128
VERSION: ${{ needs.get-context.outputs.new-version }}
129+
RELEASE_NOTES: ${{ steps.generate-notes.outputs.notes }}
98130

99131
build-and-push:
100132
name: Build and push image to GHCR

.releaserc.json

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"branches": ["master"],
3+
"plugins": [
4+
"@semantic-release/commit-analyzer",
5+
[
6+
"@semantic-release/release-notes-generator",
7+
{
8+
"preset": "angular",
9+
"presetConfig": {
10+
"types": [
11+
{
12+
"type": "feat",
13+
"section": "Features",
14+
"hidden": false
15+
},
16+
{
17+
"type": "fix",
18+
"section": "Bug Fixes",
19+
"hidden": false
20+
},
21+
{
22+
"type": "docs",
23+
"section": "Documentation",
24+
"hidden": false
25+
},
26+
{
27+
"type": "style",
28+
"section": "Styles",
29+
"hidden": false
30+
},
31+
{
32+
"type": "refactor",
33+
"section": "Code Refactoring",
34+
"hidden": false
35+
},
36+
{
37+
"type": "perf",
38+
"section": "Performance Improvements",
39+
"hidden": false
40+
},
41+
{
42+
"type": "test",
43+
"section": "Tests",
44+
"hidden": false
45+
},
46+
{
47+
"type": "build",
48+
"section": "Build System",
49+
"hidden": false
50+
},
51+
{
52+
"type": "ci",
53+
"section": "Continuous Integration",
54+
"hidden": false
55+
},
56+
{
57+
"type": "chore",
58+
"section": "Chores",
59+
"hidden": false
60+
},
61+
{
62+
"type": "revert",
63+
"section": "Reverts",
64+
"hidden": false
65+
}
66+
]
67+
}
68+
}
69+
]
70+
]
71+
}

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in the [GitHub releases](https://github.com/BitGo/advanced-wallets/releases).
4+
5+
For detailed release notes with categorized changes (Features, Bug Fixes, Breaking Changes, etc.), please visit our [GitHub releases page](https://github.com/BitGo/advanced-wallets/releases).

0 commit comments

Comments
 (0)