Skip to content

Commit ce43a8c

Browse files
authored
Updated version incrementing suggestion in release script based on team discussion (#14389)
1 parent f64906f commit ce43a8c

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

scripts/release/prepare-canary-commands/download-build-artifacts.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
const http = require('request-promise-json');
66
const {exec} = require('child-process-promise');
7-
const {readdirSync} = require('fs');
7+
const {existsSync, readdirSync} = require('fs');
88
const {readJsonSync} = require('fs-extra');
99
const {join} = require('path');
1010
const {logPromise} = require('../utils');
@@ -20,6 +20,10 @@ const run = async ({build, cwd}) => {
2020
entry => entry.path === 'home/circleci/project/node_modules.tgz'
2121
).url;
2222

23+
if (!existsSync(join(cwd, 'build'))) {
24+
await exec(`mkdir ./build`, {cwd});
25+
}
26+
2327
// Download and extract artifact
2428
await exec(`rm -rf ./build/node_modules*`, {cwd});
2529
await exec(`curl ${nodeModulesURL} --output ./build/node_modules.tgz`, {cwd});

scripts/release/prepare-stable-commands/check-out-packages.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ const run = async ({cwd, local, packages, version}) => {
1818
return;
1919
}
2020

21+
if (!existsSync(join(cwd, 'build'))) {
22+
await exec(`mkdir ./build`, {cwd});
23+
}
24+
2125
// Cleanup from previous builds
2226
await exec(`rm -rf ./build/node_modules*`, {cwd});
2327
await exec(`mkdir ./build/node_modules`, {cwd});

scripts/release/prepare-stable-commands/guess-stable-version-numbers.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ const semver = require('semver');
66
const {execRead, logPromise} = require('../utils');
77

88
const run = async ({cwd, packages}, versionsMap) => {
9+
const branch = await execRead('git branch | grep \\* | cut -d " " -f2', {
10+
cwd,
11+
});
12+
913
for (let i = 0; i < packages.length; i++) {
1014
const packageName = packages[i];
1115

@@ -17,7 +21,13 @@ const run = async ({cwd, packages}, versionsMap) => {
1721

1822
// Guess the next version by incrementing patch.
1923
// 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+
}
2131
} catch (error) {
2232
// If the package has not yet been published,
2333
// we'll require a version number to be entered later.

0 commit comments

Comments
 (0)