diff --git a/gulpfile.js b/gulpfile.js index 4e96cd278..d879fdb84 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -801,6 +801,14 @@ function getRebuildBranchName() { return 'rebuild_' + mm + '_' + dd + '_' + yyyy; }; +// Helper function: get a name for a rebuild branch. Format: rebuild_yyyy_mm. +function getRCBranchName() { + var date = new Date(); + var mm = date.getMonth() + 1; // Month, 0-11 + var yyyy = date.getFullYear(); + return 'rc_' + yyyy + '_' + mm; +}; + // Recompile and push to origin. gulp.task('recompile', gulp.series([ 'git-sync-develop', @@ -822,3 +830,17 @@ gulp.task('recompile', gulp.series([ } ]) ); + +// Create and push an RC branch. +// Note that this pushes to google/blockly. +gulp.task('git-create-rc', gulp.series([ + 'git-sync-develop', + function(done) { + var branchName = getRCBranchName(); + execSync('git checkout -b ' + branchName, { stdio: 'inherit' }); + execSync('git push https://github.com/google/blockly.git ' + branchName, + { stdio: 'inherit' }); + done(); + }, + ]) +);