From 8f5923f9bf2677f801d3dd88e328ade6dbb19d3b Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 20 Aug 2018 08:17:47 -0700 Subject: [PATCH] chore: add option to return next version from prepare-release (#14212) * chore: add option to return next version from prepare-release * shuffle logic --- script/prepare-release.js | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/script/prepare-release.js b/script/prepare-release.js index dff1412a35e4..ac494958e1d9 100755 --- a/script/prepare-release.js +++ b/script/prepare-release.js @@ -31,7 +31,9 @@ const gitDir = path.resolve(__dirname, '..') github.authenticate({type: 'token', token: process.env.ELECTRON_GITHUB_TOKEN}) async function getNewVersion (dryRun) { - console.log(`Bumping for new "${versionType}" version.`) + if (!dryRun) { + console.log(`Bumping for new "${versionType}" version.`) + } let bumpScript = path.join(__dirname, 'bump-version.py') let scriptArgs = [bumpScript, '--bump', versionType] if (args.stable) { @@ -261,25 +263,25 @@ async function prepareRelease (isBeta, notesOnly) { console.log(`${fail} Automatic release is only supported for beta and nightly releases`) process.exit(1) } - let currentBranch - if (args.branch) { - currentBranch = args.branch + if (args.dryRun) { + let newVersion = await getNewVersion(true) + console.log(newVersion) } else { - currentBranch = await getCurrentBranch(gitDir) - } - if (notesOnly) { - let releaseNotes = await getReleaseNotes(currentBranch) - console.log(`Draft release notes are: \n${releaseNotes}`) - } else { - const changes = await changesToRelease(currentBranch) - if (changes) { - await verifyNewVersion() - await createRelease(currentBranch, isBeta) - await pushRelease(currentBranch) - await runReleaseBuilds(currentBranch) + const currentBranch = (args.branch) ? args.branch : await getCurrentBranch(gitDir) + if (notesOnly) { + let releaseNotes = await getReleaseNotes(currentBranch) + console.log(`Draft release notes are: \n${releaseNotes}`) } else { - console.log(`There are no new changes to this branch since the last release, aborting release.`) - process.exit(1) + const changes = await changesToRelease(currentBranch) + if (changes) { + await verifyNewVersion() + await createRelease(currentBranch, isBeta) + await pushRelease(currentBranch) + await runReleaseBuilds(currentBranch) + } else { + console.log(`There are no new changes to this branch since the last release, aborting release.`) + process.exit(1) + } } } }