File tree Expand file tree Collapse file tree 3 files changed +44
-3
lines changed
Expand file tree Collapse file tree 3 files changed +44
-3
lines changed Original file line number Diff line number Diff line change 7474 git tag "v${CLI_VERSION}"
7575 git push origin main --tags
7676
77+ # Create GitHub Release
78+ npx tsx scripts/extract-changelog.ts "$CLI_VERSION" > /tmp/release-notes.md
79+ gh release create "v${CLI_VERSION}" \
80+ --title "v${CLI_VERSION}" \
81+ --notes-file /tmp/release-notes.md
82+
7783 # Publish to npm
7884 npm publish --provenance --access public
85+ env :
86+ GH_TOKEN : ${{ github.token }}
Original file line number Diff line number Diff line change 1+ /**
2+ * Extract changelog section for a given version from CHANGELOG.md.
3+ * Usage: npx tsx scripts/extract-changelog.ts 6.3.4
4+ */
5+
6+ import fs from 'node:fs' ;
7+
8+ const version = process . argv [ 2 ] ;
9+ if ( ! version ) {
10+ console . error ( 'Usage: tsx scripts/extract-changelog.ts <version>' ) ;
11+ process . exit ( 1 ) ;
12+ }
13+
14+ const content = fs . readFileSync ( 'CHANGELOG.md' , 'utf8' ) ;
15+ const regex = new RegExp (
16+ `^## .*?${ version . replace ( / \. / g, '\\.' ) } .*?\n(.*?)(?=^## |\\Z)` ,
17+ 'ms' ,
18+ ) ;
19+ const match = regex . exec ( content ) ;
20+ if ( match ) {
21+ process . stdout . write ( match [ 1 ] . trim ( ) + '\n' ) ;
22+ } else {
23+ process . stdout . write ( `Release v${ version } \n` ) ;
24+ }
Original file line number Diff line number Diff line change @@ -104,9 +104,18 @@ function main() {
104104 }
105105 console . log ( `Latest v${ major } : ${ latestTag } ` ) ;
106106
107- // Extract primary (latest) snapshot → data/v{major}.json
108- checkout ( antdDir , latestTag ) ;
109- extract ( antdDir , `data/v${ major } .json` ) ;
107+ // Extract primary (latest) snapshot → data/v{major}.json (skip if already up-to-date)
108+ const primaryFile = `data/v${ major } .json` ;
109+ const currentVersion = fs . existsSync ( primaryFile )
110+ ? JSON . parse ( fs . readFileSync ( primaryFile , 'utf8' ) ) . version
111+ : null ;
112+ if ( currentVersion === latestTag ) {
113+ console . log ( ` v${ major } already at ${ latestTag } , skipping primary extract` ) ;
114+ } else {
115+ console . log ( ` v${ major } : ${ currentVersion } → ${ latestTag } ` ) ;
116+ checkout ( antdDir , latestTag ) ;
117+ extract ( antdDir , primaryFile ) ;
118+ }
110119
111120 // Extract per-minor snapshots, skip ones that already exist
112121 for ( const [ minorKey , tag ] of minorMap ) {
You can’t perform that action at this time.
0 commit comments