Skip to content

Commit 9677409

Browse files
committed
Update release script for backports
1 parent c8cf1f9 commit 9677409

1 file changed

Lines changed: 15 additions & 16 deletions

File tree

scripts/release.js

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@ import { runAndGetStdout, runWithEcho } from './helpers.js';
1414
// We execute everything from the main directory
1515
chdir(fileURLToPath(new URL('..', import.meta.url)));
1616

17-
const MAIN_BRANCH = 'master';
17+
const BACKPORTS_MAIN_BRANCH = 'backports-rollup-3';
1818
const MAIN_PACKAGE = 'package.json';
1919
const MAIN_LOCKFILE = 'package-lock.json';
2020
const BROWSER_PACKAGE = 'browser/package.json';
2121
const CHANGELOG = 'CHANGELOG.md';
22-
const DOCUMENTATION_BRANCH = 'documentation-published';
2322

2423
const [gh, currentBranch] = await Promise.all([
2524
getGithubApi(),
@@ -34,7 +33,7 @@ const [mainPackage, mainLockFile, browserPackage, repo, issues, changelog] = awa
3433
gh.getIssues('rollup', 'rollup'),
3534
readFile(CHANGELOG, 'utf8')
3635
]);
37-
const isMainBranch = currentBranch === MAIN_BRANCH;
36+
const isMainBranch = currentBranch === BACKPORTS_MAIN_BRANCH;
3837
const [newVersion, includedPRs] = await Promise.all([
3938
getNewVersion(mainPackage, isMainBranch),
4039
getIncludedPRs(changelog, repo, currentBranch, isMainBranch)
@@ -56,7 +55,7 @@ try {
5655
throw error;
5756
}
5857

59-
await releasePackages(newVersion);
58+
await releasePackages();
6059
await pushChanges(gitTag);
6160
if (changelogEntry) {
6261
await createReleaseNotes(changelogEntry, gitTag);
@@ -231,12 +230,8 @@ function getDummyLogSection(headline, pr) {
231230
}
232231

233232
async function installDependenciesBuildAndTest() {
234-
await Promise.all([runWithEcho('npm', ['ci']), runWithEcho('npm', ['audit'])]);
235-
await Promise.all([
236-
runWithEcho('npm', ['run', 'ci:lint']),
237-
runWithEcho('npm', ['run', 'build:bootstrap'])
238-
]);
239-
await runWithEcho('npm', ['run', 'test:all']);
233+
await Promise.all([runWithEcho('npm', ['ci'])]);
234+
await Promise.all([runWithEcho('npm', ['run', 'build:bootstrap'])]);
240235
}
241236

242237
async function waitForChangelogUpdate(version) {
@@ -293,13 +288,18 @@ async function commitChanges(newVersion, gitTag, isMainBranch) {
293288
]);
294289
await runWithEcho('git', ['commit', '-m', newVersion]);
295290
await runWithEcho('git', ['tag', gitTag]);
296-
isMainBranch && (await runWithEcho('git', ['branch', DOCUMENTATION_BRANCH, '--force', gitTag]));
297291
}
298292

299-
function releasePackages(newVersion) {
293+
async function releasePackages() {
300294
const releaseEnvironment = { ...process.env, ROLLUP_RELEASE: 'releasing' };
301-
const releaseTag = semverPreRelease(newVersion) ? ['--tag', 'beta'] : [];
302-
const parameters = ['publish', '--access', 'public', ...releaseTag];
295+
const { otp } = await inquirer.prompt([
296+
{
297+
message: 'Enter npm one-time password:',
298+
name: 'otp',
299+
type: 'input'
300+
}
301+
]);
302+
const parameters = ['publish', '--access', 'public', '--tag', 'backports-3', `--otp=${otp}`];
303303
return Promise.all([
304304
runWithEcho('npm', parameters, {
305305
cwd: new URL('..', import.meta.url),
@@ -315,8 +315,7 @@ function releasePackages(newVersion) {
315315
function pushChanges(gitTag) {
316316
return Promise.all([
317317
runWithEcho('git', ['push', 'origin', 'HEAD']),
318-
runWithEcho('git', ['push', 'origin', gitTag]),
319-
isMainBranch && runWithEcho('git', ['push', '--force', 'origin', DOCUMENTATION_BRANCH])
318+
runWithEcho('git', ['push', 'origin', gitTag])
320319
]);
321320
}
322321

0 commit comments

Comments
 (0)