Add script to bump minor version number

Creates a new branch, bumps, builds, tags, and pushes the new branch and new tag.
This commit is contained in:
Rachel Fenichel
2019-10-18 14:23:17 -07:00
parent ff87c135ee
commit 3946b56a26
2 changed files with 41 additions and 2 deletions

View File

@@ -37,6 +37,7 @@ var closureCompiler = require('google-closure-compiler').gulp();
var packageJson = require('./package.json');
var argv = require('yargs').argv;
const upstream_url = "https://github.com/google/blockly.git";
////////////////////////////////////////////////////////////
// Build //
@@ -779,7 +780,7 @@ function syncBranch(branchName) {
return function(done) {
execSync('git stash save -m "Stash for sync"', { stdio: 'inherit' });
execSync('git checkout ' + branchName, { stdio: 'inherit' });
execSync('git pull https://github.com/google/blockly.git ' + branchName,
execSync('git pull ' + upstream_url + ' ' + branchName,
{ stdio: 'inherit' });
execSync('git push origin ' + branchName, { stdio: 'inherit' });
done();
@@ -809,6 +810,15 @@ function getRCBranchName() {
return 'rc_' + yyyy + '_' + mm;
};
// Helper function: get a minor version number for the day. Format: yyyymmdd.
function getNewMinorVersionNumber() {
var date = new Date();
var mm = date.getMonth() + 1; // Month, 0-11
var dd = date.getDate(); // Day of the month, 1-31
var yyyy = date.getFullYear();
return yyyy + '' + mm + '' + dd;
};
// Recompile and push to origin.
gulp.task('recompile', gulp.series([
'git-sync-develop',
@@ -838,9 +848,34 @@ gulp.task('git-create-rc', gulp.series([
function(done) {
var branchName = getRCBranchName();
execSync('git checkout -b ' + branchName, { stdio: 'inherit' });
execSync('git push https://github.com/google/blockly.git ' + branchName,
execSync('git push ' + upstream_url + ' ' + branchName,
{ stdio: 'inherit' });
done();
},
])
);
// See https://docs.npmjs.com/cli/version.
gulp.task('preversion', gulp.series([
'git-sync-master',
function(done) {
// Create a branch named bump_version for the bump and rebuild.
execSync('git checkout -b bump_version', { stdio: 'inherit' });
done();
},
])
);
// See https://docs.npmjs.com/cli/version
gulp.task('postversion', gulp.series([
function(done) {
// Push both the branch and tag to google/blockly.
execSync('git push ' + upstream_url + ' bump_version',
{ stdio: 'inherit' });
var tagName = 'v' + packageJson.version;
execSync('git push ' + upstream_url + ' ' + tagName,
{ stdio: 'inherit' });
done();
}
])
);