Skip to content

Commit 4562f2e

Browse files
committed
ci: 👷 Added release notes to github release
1 parent 8f854a5 commit 4562f2e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

.github/workflows/npm-publish.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
packages: write
1414
steps:
1515
- uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0 # This is important for getting all tags
1618

1719
- name: Setup Node.js
1820
uses: actions/setup-node@v3
@@ -40,11 +42,22 @@ jobs:
4042
echo "cjs_file=$CJS_FILE" >> $GITHUB_OUTPUT
4143
echo "esm_file=$ESM_FILE" >> $GITHUB_OUTPUT
4244
echo "types_file=$TYPES_FILE" >> $GITHUB_OUTPUT
45+
4346
- name: Publish to npm
4447
run: npm publish
4548
env:
4649
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4750

51+
- name: Get Changelog Entry
52+
id: get_changelog
53+
run: |
54+
VERSION=${GITHUB_REF#refs/tags/}
55+
CHANGELOG_ENTRY=$(awk "/^## \[$VERSION\]/ {flag=1;next} /^## \[/ {flag=0} flag" CHANGELOG.md)
56+
CHANGELOG_ENTRY="${CHANGELOG_ENTRY//'%'/'%25'}"
57+
CHANGELOG_ENTRY="${CHANGELOG_ENTRY//$'\n'/'%0A'}"
58+
CHANGELOG_ENTRY="${CHANGELOG_ENTRY//$'\r'/'%0D'}"
59+
echo "changelog=$CHANGELOG_ENTRY" >> $GITHUB_OUTPUT
60+
4861
- name: Create Release
4962
id: create_release
5063
uses: actions/create-release@v1
@@ -53,6 +66,8 @@ jobs:
5366
with:
5467
tag_name: ${{ github.ref }}
5568
release_name: Release ${{ github.ref }}
69+
body: |
70+
${{ steps.get_changelog.outputs.changelog }}
5671
draft: false
5772
prerelease: false
5873

0 commit comments

Comments
 (0)