Skip to content

Commit 89c1199

Browse files
committed
feat: enhance draft release creation with auto-generated changelog and download links
1 parent ebdaa6b commit 89c1199

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

.github/workflows/release.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,40 @@ jobs:
1717
release_id: ${{ steps.create.outputs.result }}
1818
steps:
1919
- uses: actions/checkout@v4
20-
- name: Create draft release
20+
21+
- name: Create draft release with auto changelog
2122
id: create
2223
uses: actions/github-script@v7
2324
with:
2425
script: |
2526
const tagName = context.ref.replace('refs/tags/', '') || 'v4.0';
27+
28+
// Use GitHub's built-in release notes generator
29+
let generatedNotes = '';
30+
try {
31+
const { data: notes } = await github.rest.repos.generateReleaseNotes({
32+
owner: context.repo.owner,
33+
repo: context.repo.repo,
34+
tag_name: tagName,
35+
});
36+
generatedNotes = notes.body;
37+
} catch (e) {
38+
console.log('Auto-generate notes failed, using fallback:', e.message);
39+
generatedNotes = '';
40+
}
41+
42+
const downloads = `\n---\n\n**Downloads**\n\n| Platform | File | Architecture |\n|----------|------|--------------|\n| macOS | \`.dmg\` | Universal (Intel + Apple Silicon) |\n| Windows | \`.msi\` / \`.exe\` | x86_64 |\n| Linux | \`.deb\` / \`.AppImage\` | x86_64 |\n| Linux CLI | \`.tar.gz\` | amd64 / aarch64 |`;
43+
44+
const body = generatedNotes
45+
? `${generatedNotes}${downloads}`
46+
: `See the assets below to download the app for your platform.${downloads}`;
47+
2648
const { data } = await github.rest.repos.createRelease({
2749
owner: context.repo.owner,
2850
repo: context.repo.repo,
2951
tag_name: tagName,
3052
name: `Fetch Github Hosts ${tagName}`,
31-
body: `See the assets below to download the app for your platform.\n\n**macOS**: \`.dmg\` (Universal binary - supports both Intel & Apple Silicon)\n**Windows**: \`.msi\` / \`.exe\`\n**Linux**: \`.deb\` / \`.AppImage\`\n**Linux Standalone Binary**: \`.tar.gz\` (amd64 / aarch64, no installation needed)`,
53+
body: body,
3254
draft: true,
3355
prerelease: false
3456
});

0 commit comments

Comments
 (0)