chore: add option to return next version from prepare-release (backport: 3-0-x) (#14217)

* chore: add option to return next version from prepare-release

* shuffle logic
This commit is contained in:
trop[bot] 2018-08-20 08:35:34 -07:00 committed by Samuel Attard
parent bd0d6b1a02
commit 058c03fdab

View file

@ -31,7 +31,9 @@ const gitDir = path.resolve(__dirname, '..')
github.authenticate({type: 'token', token: process.env.ELECTRON_GITHUB_TOKEN}) github.authenticate({type: 'token', token: process.env.ELECTRON_GITHUB_TOKEN})
async function getNewVersion (dryRun) { async function getNewVersion (dryRun) {
if (!dryRun) {
console.log(`Bumping for new "${versionType}" version.`) console.log(`Bumping for new "${versionType}" version.`)
}
let bumpScript = path.join(__dirname, 'bump-version.py') let bumpScript = path.join(__dirname, 'bump-version.py')
let scriptArgs = [bumpScript, '--bump', versionType] let scriptArgs = [bumpScript, '--bump', versionType]
if (args.stable) { if (args.stable) {
@ -263,12 +265,11 @@ async function prepareRelease (isBeta, notesOnly) {
console.log(`${fail} Automatic release is only supported for beta and nightly releases`) console.log(`${fail} Automatic release is only supported for beta and nightly releases`)
process.exit(1) process.exit(1)
} }
let currentBranch if (args.dryRun) {
if (args.branch) { let newVersion = await getNewVersion(true)
currentBranch = args.branch console.log(newVersion)
} else { } else {
currentBranch = await getCurrentBranch(gitDir) const currentBranch = (args.branch) ? args.branch : await getCurrentBranch(gitDir)
}
if (notesOnly) { if (notesOnly) {
let releaseNotes = await getReleaseNotes(currentBranch) let releaseNotes = await getReleaseNotes(currentBranch)
console.log(`Draft release notes are: \n${releaseNotes}`) console.log(`Draft release notes are: \n${releaseNotes}`)
@ -284,6 +285,7 @@ async function prepareRelease (isBeta, notesOnly) {
process.exit(1) process.exit(1)
} }
} }
}
} }
prepareRelease(!args.stable, args.notesOnly) prepareRelease(!args.stable, args.notesOnly)