Skip to content

Commit cfc3fb7

Browse files
committed
ci: Extract latest changelog entry to GH release
1 parent cb9ea60 commit cfc3fb7

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const { readFileSync } = require('node:fs');
2+
const { join } = require('node:path');
3+
4+
module.exports = () => {
5+
const contents = readFileSync(join(__dirname, '..', 'CHANGELOG.md'), { encoding: 'utf8' });
6+
return contents.match(/## .*?\n(.*?)## [\d[]/s)[1].trim();
7+
};

.github/workflows/release.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,21 @@ jobs:
3131
- name: Build
3232
run: yarn build
3333

34+
- name: Getting latest changelog entry
35+
uses: actions/github-script@v7
36+
id: latest-changelog-entry
37+
with:
38+
result-encoding: string
39+
script: |
40+
const extractLatestChangelogEntry = require('./.github/extract-latest-changelog-entry.cjs');
41+
return extractLatestChangelogEntry();
42+
3443
- name: Create release
3544
uses: softprops/action-gh-release@v1
3645
env:
3746
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
with:
48+
body: ${{steps.latest-changelog-entry.outputs.result}}
3849

3950
- name: Publish package
4051
run: yarn publish --access public

0 commit comments

Comments
 (0)