Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

Commit 4b30114

Browse files
Add changelog entries to release notes
1 parent 33f96c4 commit 4b30114

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

docs/release-notes-template.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
:tada: **Thanks for downloading Patchwork!** Check out [the changelog](https://github.com/ssbc/patchwork/blob/master/docs/CHANGELOG.md) to see what's new.
2-
32
## Install
43

54
- **Windows:** [`ssb-patchwork-setup-$$VERSION.exe`][exe]
65
- **macOS:** [`Patchwork-$$VERSION.dmg`][dmg] (you may need to [allow apps from "unidentified" developers](https://support.apple.com/kb/PH25088))
76
- **Linux:** [`ssb-patchwork-$$VERSION-x86_64.AppImage`][appimage] (you will need to [make it executable](https://docs.appimage.org/user-guide/run-appimages.html))
87

9-
108
## Getting started
119

1210
If this is your first time on Scuttlebutt you may need an invite to get connected. After installing Patchwork and choosing your name you should select the **Join Pub** button. You'll need to [get a pub invite](https://github.com/ssbc/ssb-server/wiki/Pub-Servers#public-pubs), paste it into the prompt, and select **Redeem invite**.
1311

1412
You can find more information in the [Getting Started Guide](https://www.scuttlebutt.nz/getting-started).
1513

14+
## Changes
15+
$$CHANGES
1616
## Support
1717
1818
:thinking: [Any questions? Check out the Scuttlebutt FAQ!](https://www.scuttlebutt.nz/faq/)

scripts/release-notes.js

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,33 @@ if (version == null) {
88
}
99

1010
const template = fs.readFileSync(path.join(__dirname, '..', 'docs', 'release-notes-template.md'), 'utf8')
11+
const changelog = fs.readFileSync(path.join(__dirname, '..', 'docs', 'CHANGELOG.md'), 'utf8')
12+
13+
let record = false
14+
const lines = changelog.split('\n')
15+
16+
const relevantLines = lines.reduce((acc, cur) => {
17+
if (cur.startsWith('## ')) {
18+
if (cur.startsWith(`## v${version}`)) {
19+
record = true
20+
return acc
21+
} else {
22+
record = false
23+
return acc
24+
}
25+
}
26+
27+
if (record) {
28+
acc.push(cur)
29+
}
30+
31+
return acc
32+
}, [])
33+
34+
const changes = relevantLines.join('\n')
35+
36+
const releaseNotes = template
37+
.replace(/\$\$VERSION/g, version)
38+
.replace(/\$\$CHANGES/g, changes)
1139

12-
const releaseNotes = template.replace(/\$\$VERSION/g, version)
1340
console.log(releaseNotes)

0 commit comments

Comments
 (0)