@@ -27,7 +27,7 @@ import * as argparse from 'argparse';
2727import chalk from 'chalk' ;
2828import * as fs from 'fs' ;
2929import * as shell from 'shelljs' ;
30- import { TMP_DIR , $ , question , makeReleaseDir , createPR , TFJS_RELEASE_UNIT , updateTFJSDependencyVersions , ALPHA_RELEASE_UNIT , getMinorUpdateVersion , getPatchUpdateVersion } from './release-util' ;
30+ import { TMP_DIR , $ , question , makeReleaseDir , createPR , TFJS_RELEASE_UNIT , updateTFJSDependencyVersions , ALPHA_RELEASE_UNIT , getMinorUpdateVersion , getPatchUpdateVersion , E2E_PHASE } from './release-util' ;
3131
3232const parser = new argparse . ArgumentParser ( ) ;
3333
@@ -36,6 +36,11 @@ parser.addArgument('--git-protocol', {
3636 help : 'Use the git protocol rather than the http protocol when cloning repos.'
3737} ) ;
3838
39+ parser . addArgument ( '--local' , {
40+ action : 'storeTrue' ,
41+ help : 'Only create the release branch locally. Do not push or create a PR.' ,
42+ } ) ;
43+
3944async function main ( ) {
4045 const args = parser . parseArgs ( ) ;
4146 const urlBase = args . git_protocol ? 'git@github.com:' : 'https://github.com/' ;
@@ -86,10 +91,14 @@ async function main() {
8691 console . log ( chalk . magenta . bold (
8792 `~~~ Creating new release branch ${ releaseBranch } ~~~` ) ) ;
8893 $ ( `git checkout -b ${ releaseBranch } ${ commit } ` ) ;
89- $ ( `git push origin ${ releaseBranch } ` ) ;
94+ if ( ! args . local ) {
95+ $ ( `git push origin ${ releaseBranch } ` ) ;
96+ }
9097
9198 // Update versions in package.json files.
92- const phases = [ ...TFJS_RELEASE_UNIT . phases , ...ALPHA_RELEASE_UNIT . phases ] ;
99+ const phases = [
100+ ...TFJS_RELEASE_UNIT . phases , ...ALPHA_RELEASE_UNIT . phases , E2E_PHASE
101+ ] ;
93102 for ( const phase of phases ) {
94103 for ( const packageName of phase . packages ) {
95104 shell . cd ( packageName ) ;
@@ -109,8 +118,8 @@ async function main() {
109118
110119 shell . cd ( '..' ) ;
111120
112- // Make version for all packages other than tfjs-node-gpu.
113- if ( packageName !== 'tfjs-node-gpu' ) {
121+ // Make version for all packages other than tfjs-node-gpu and e2e .
122+ if ( packageName !== 'tfjs-node-gpu' && packageName !== 'e2e' ) {
114123 $ ( `./scripts/make-version.js ${ packageName } ` ) ;
115124 }
116125 }
@@ -120,7 +129,9 @@ async function main() {
120129 const devBranchName = `dev_${ releaseBranch } ` ;
121130
122131 const message = `Update monorepo to ${ newVersion } .` ;
123- createPR ( devBranchName , releaseBranch , message ) ;
132+ if ( ! args . local ) {
133+ createPR ( devBranchName , releaseBranch , message ) ;
134+ }
124135
125136 console . log (
126137 'Done. FYI, this script does not publish to NPM. ' +
@@ -131,6 +142,9 @@ async function main() {
131142 'Please remeber to update the website once you have released ' +
132143 'a new package version.' ) ;
133144
145+ if ( args . local ) {
146+ console . log ( `Local output located in ${ dir } ` )
147+ }
134148 process . exit ( 0 ) ;
135149}
136150
0 commit comments