File tree Expand file tree Collapse file tree
packages/vscode-extension Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3333 run : |
3434 if [ "${{ github.event.inputs.isRelease }}" != "yes" ]; then
3535 node ./version.cjs
36+ else
37+ node ./version.cjs --release
3638 fi
3739 npx vsce package
3840 ls -lsh ./
Original file line number Diff line number Diff line change @@ -10,18 +10,24 @@ function getFormattedDate(timestamp) {
1010 return `${ year } ${ month } ${ day } ` ;
1111}
1212
13+ const isRelease = process . argv [ 2 ] === '--release' ;
1314let { version : baseVersion } = packageJson ;
1415baseVersion = baseVersion . split ( '-' ) [ 0 ] ;
1516
16- const nowTimestamp = Date . now ( ) ;
17- const newVersion = `${ baseVersion } -alpha.${ getFormattedDate ( nowTimestamp ) } .${ nowTimestamp } ` ;
18- fs . writeFileSync ( './package.json' , JSON . stringify ( {
19- ...packageJson ,
20- version : newVersion ,
21- } , null , 2 ) ) ;
17+ if ( isRelease ) {
18+ // Update in Github Action
19+ console . info ( '::set-output name=release_version::' + baseVersion ) ;
20+ } else {
21+ const nowTimestamp = Date . now ( ) ;
22+ const newVersion = `${ baseVersion } -alpha.${ getFormattedDate ( nowTimestamp ) } .${ nowTimestamp } ` ;
23+ fs . writeFileSync ( './package.json' , JSON . stringify ( {
24+ ...packageJson ,
25+ version : newVersion ,
26+ } , null , 2 ) ) ;
2227
23- console . log (
24- `package.json is updated` , fs . readFileSync ( './package.json' , 'utf-8' ) ) ;
28+ console . log (
29+ `package.json is updated` , fs . readFileSync ( './package.json' , 'utf-8' ) ) ;
2530
26- // Update in Github Action
27- console . info ( '::set-output name=release_version::' + newVersion ) ;
31+ // Update in Github Action
32+ console . info ( '::set-output name=release_version::' + newVersion ) ;
33+ }
You can’t perform that action at this time.
0 commit comments