@@ -93,13 +93,37 @@ jobs:
9393 - name : 📦 Install dependencies
9494 run : npm ci
9595
96- - name : 🏷️ Get Version from package.json
97- id : get_version
96+ - name : 🏷️ Get Version and Extract Changelog
97+ id : get_release_info
9898 shell : bash
9999 run : |
100100 VERSION=$(node -p "require('./package.json').version")
101101 echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
102102
103+ # Extract the section from CHANGELOG.md for the current version
104+ # It looks for the header ## [VERSION] and takes everything until the next ## [
105+ # Then we remove the last line (the next header) and any trailing link if it's there
106+ # Using a temporary node script for robust cross-platform parsing
107+ cat << 'EOF' > extract_changelog.js
108+ const fs = require('fs');
109+ const content = fs.readFileSync('CHANGELOG.md', 'utf8');
110+ const version = process.argv[2];
111+ const regex = new RegExp(`## \\[${version.replace(/\./g, '\\.')}\\][\\s\\S]*?(?=## \\[|$)`);
112+ const match = content.match(regex);
113+ if (match) {
114+ let notes = match[0].trim();
115+ // Remove the version header itself from the body
116+ notes = notes.replace(/^## \[.*\] - .*\n/, '').trim();
117+ fs.writeFileSync('release_notes.md', notes);
118+ console.log('Changelog extracted successfully');
119+ } else {
120+ fs.writeFileSync('release_notes.md', 'New version release.');
121+ console.log('Version section not found in CHANGELOG.md');
122+ }
123+ EOF
124+
125+ node extract_changelog.js $VERSION
126+
103127 - name : 🔨 Build Standalone EXE
104128 run : npm run build:sea
105129
@@ -119,13 +143,15 @@ jobs:
119143 with :
120144 files : dist/remote-opencode.exe
121145 # Dynamic name using the version from package.json
122- name : ${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || format('Release v{0}', steps.get_version .outputs.VERSION) }}
146+ name : ${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || format('Release v{0}', steps.get_release_info .outputs.VERSION) }}
123147 # Use the tag from git if available, otherwise fallback to 'latest'
124148 tag_name : ${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || 'latest' }}
149+ body_path : release_notes.md
125150 draft : false
126- prerelease : false # Force it to show as a "Main Release"
127- generate_release_notes : true # This will populate the body with the commit log
128- make_latest : true # Ensures this is the one users see first
151+ prerelease : false
152+ append_body : true # Append the "Full Changelog" link below our extracted notes
153+ generate_release_notes : true # This will append the contributor list and link below our custom body
154+ make_latest : true
129155 env :
130156 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
131157
@@ -143,7 +169,7 @@ jobs:
143169 - 🧪 Unit Tests: Passed
144170 - 🏗️ Build EXE: Standalone Windows binary generated successfully.
145171
146- This PR is ready to be merged. Once merged to main, a new **Main Release** will be automatically created! 🎉`;
172+ This PR is ready to be merged. Once merged to main, a new **Main Release** will be automatically created with notes from CHANGELOG.md ! 🎉`;
147173
148174 github.rest.issues.createComment({
149175 issue_number: context.issue.number,
0 commit comments