Updated version incrementing suggestion in release script based on team discussion (#14389)
Brian Vaughn committed
Dec 7, 2018 at 09:08 UTC
ce43a8cd07c355647922480977b46713bd51883e
3 files changed
+20
-2
scripts/release/prepare-canary-commands/download-build-artifacts.js
+5
-1
@@ -4,7 +4,7 @@
4
5
const http = require('request-promise-json');
6
const {exec} = require('child-process-promise');
7
-const {readdirSync} = require('fs');
7
+const {existsSync, readdirSync} = require('fs');
8
const {readJsonSync} = require('fs-extra');
9
const {join} = require('path');
10
const {logPromise} = require('../utils');
@@ -20,6 +20,10 @@ const run = async ({build, cwd}) => {
20
entry => entry.path === 'home/circleci/project/node_modules.tgz'
21
).url;
22
23
+ if (!existsSync(join(cwd, 'build'))) {
24
+ await exec(`mkdir ./build`, {cwd});
25
+ }
26
+
27
// Download and extract artifact
28
await exec(`rm -rf ./build/node_modules*`, {cwd});
29
await exec(`curl ${nodeModulesURL} --output ./build/node_modules.tgz`, {cwd});
scripts/release/prepare-stable-commands/check-out-packages.js
+4
@@ -18,6 +18,10 @@ const run = async ({cwd, local, packages, version}) => {
18
return;
19
}
20
21
+ if (!existsSync(join(cwd, 'build'))) {
22
+ await exec(`mkdir ./build`, {cwd});
23
+ }
24
+
25
// Cleanup from previous builds
26
await exec(`rm -rf ./build/node_modules*`, {cwd});
27
await exec(`mkdir ./build/node_modules`, {cwd});
scripts/release/prepare-stable-commands/guess-stable-version-numbers.js
+11
-1
@@ -6,6 +6,10 @@ const semver = require('semver');
6
const {execRead, logPromise} = require('../utils');
7
8
const run = async ({cwd, packages}, versionsMap) => {
9
+ const branch = await execRead('git branch | grep \\* | cut -d " " -f2', {
10
+ cwd,
11
+ });
12
+
13
for (let i = 0; i < packages.length; i++) {
14
const packageName = packages[i];
15
@@ -17,7 +21,13 @@ const run = async ({cwd, packages}, versionsMap) => {
21
22
// Guess the next version by incrementing patch.
23
// The script will confirm this later.
20
- versionsMap.set(packageName, `${major}.${minor}.${patch + 1}`);
24
+ // By default, new releases from masters should increment the minor version number,
25
+ // and patch releases should be done from branches.
26
+ if (branch === 'master') {
27
+ versionsMap.set(packageName, `${major}.${minor + 1}.0`);
28
+ } else {
29
+ versionsMap.set(packageName, `${major}.${minor}.${patch + 1}`);
30
+ }
31
} catch (error) {
32
// If the package has not yet been published,
33
// we'll require a version number to be entered later.