@@ -30,30 +30,42 @@ jobs:
3030 run : npm run build
3131
3232 - name : Create Release
33- uses : actions/create-release@v1
34- env :
35- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
33+ uses : actions/github-script@v7
3634 with :
37- tag_name : ${{ github.ref }}
38- release_name : Release ${{ github.ref }}
39- body : |
40- ## 🎉 Release ${{ github.ref }}
35+ script : |
36+ const tag = context.ref.replace('refs/tags/', '');
37+ const changelog = await github.rest.repos.getContent({
38+ owner: context.repo.owner,
39+ repo: context.repo.repo,
40+ path: 'CHANGELOG.md'
41+ });
4142
42- ### What's New
43- - Check the [CHANGELOG.md](https://github.com/HUA-Labs/i18n-sdk/blob/main/CHANGELOG.md) for detailed changes
43+ const changelogContent = Buffer.from(changelog.data.content, 'base64').toString();
44+ const versionSection = changelogContent.split('## [' + tag + ']')[1];
45+ const releaseNotes = versionSection ? versionSection.split('## [')[0] : '';
4446
45- ### Installation
46- ```bash
47- npm install hua-i18n-sdk
48- ```
49-
50- ### Documentation
51- - [API Reference](https://github.com/HUA-Labs/i18n-sdk#api-reference)
52- - [Examples](https://github.com/HUA-Labs/i18n-sdk/tree/main/examples)
53- - [Getting Started](https://github.com/HUA-Labs/i18n-sdk#getting-started)
54-
55- ### Support
56- - [Issues](https://github.com/HUA-Labs/i18n-sdk/issues)
57- - [Discussions](https://github.com/HUA-Labs/i18n-sdk/discussions)
58- draft : false
59- prerelease : false
47+ await github.rest.repos.createRelease({
48+ owner: context.repo.owner,
49+ repo: context.repo.repo,
50+ tag_name: tag,
51+ name: 'Release ' + tag,
52+ body: `## 🎉 Release ${tag}
53+
54+ ${releaseNotes}
55+
56+ ### Installation
57+ \`\`\`bash
58+ npm install hua-i18n-sdk
59+ \`\`\`
60+
61+ ### Documentation
62+ - [API Reference](https://github.com/HUA-Labs/i18n-sdk#api-reference)
63+ - [Examples](https://github.com/HUA-Labs/i18n-sdk/tree/main/examples)
64+ - [Getting Started](https://github.com/HUA-Labs/i18n-sdk#getting-started)
65+
66+ ### Support
67+ - [Issues](https://github.com/HUA-Labs/i18n-sdk/issues)
68+ - [Discussions](https://github.com/HUA-Labs/i18n-sdk/discussions)`,
69+ draft: false,
70+ prerelease: false
71+ });
0 commit comments