Skip to content

Commit

Permalink
chore: add option to return next version from prepare-release (backpo…
Browse files Browse the repository at this point in the history
…rt: 2-0-x) (#14216)

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

* shuffle logic
  • Loading branch information
trop[bot] authored and MarshallOfSound committed Aug 20, 2018
1 parent d483c81 commit f1b197a
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions script/prepare-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
} else {
currentBranch = await getCurrentBranch(gitDir)
}
if (notesOnly) {
let releaseNotes = await getReleaseNotes(currentBranch)
console.log(`Draft release notes are: \n${releaseNotes}`)
if (args.dryRun) {
let newVersion = await getNewVersion(true)
console.log(newVersion)
} 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)
}
}
}
}
Expand Down

0 comments on commit f1b197a

Please sign in to comment.