Merge pull request #11793 from electron/release-updates
Improvements to release process
This commit is contained in:
commit
a0e584efeb
4 changed files with 53 additions and 14 deletions
|
@ -164,7 +164,7 @@ This release is published to [npm](https://www.npmjs.com/package/electron) under
|
||||||
1. Uncheck the `prerelease` checkbox if you're publishing a stable release; leave it checked for beta releases.
|
1. Uncheck the `prerelease` checkbox if you're publishing a stable release; leave it checked for beta releases.
|
||||||
1. Click 'Save draft'. **Do not click 'Publish release'!**
|
1. Click 'Save draft'. **Do not click 'Publish release'!**
|
||||||
1. Wait for all builds to pass before proceeding.
|
1. Wait for all builds to pass before proceeding.
|
||||||
1. You can run `npm run release --validateRelease` to verify that all of the
|
1. You can run `npm run release -- --validateRelease` to verify that all of the
|
||||||
required files have been created for the release.
|
required files have been created for the release.
|
||||||
|
|
||||||
## Merge temporary branch
|
## Merge temporary branch
|
||||||
|
|
|
@ -199,7 +199,7 @@ function runRelease (targetBranch, options) {
|
||||||
module.exports = runRelease
|
module.exports = runRelease
|
||||||
|
|
||||||
if (require.main === module) {
|
if (require.main === module) {
|
||||||
const args = require('minimist')(process.argv.slice(2))
|
const args = require('minimist')(process.argv.slice(2), { boolean: 'ghRelease' })
|
||||||
const targetBranch = args._[0]
|
const targetBranch = args._[0]
|
||||||
if (args._.length < 1) {
|
if (args._.length < 1) {
|
||||||
console.log(`Trigger CI to build release builds of electron.
|
console.log(`Trigger CI to build release builds of electron.
|
||||||
|
|
|
@ -11,6 +11,7 @@ const GitHub = require('github')
|
||||||
const pass = '\u2713'.green
|
const pass = '\u2713'.green
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const pkg = require('../package.json')
|
const pkg = require('../package.json')
|
||||||
|
const readline = require('readline')
|
||||||
const versionType = args._[0]
|
const versionType = args._[0]
|
||||||
|
|
||||||
// TODO (future) automatically determine version based on conventional commits
|
// TODO (future) automatically determine version based on conventional commits
|
||||||
|
@ -45,18 +46,23 @@ async function createReleaseBranch () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNewVersion () {
|
function getNewVersion (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) {
|
||||||
scriptArgs.push('--stable')
|
scriptArgs.push('--stable')
|
||||||
}
|
}
|
||||||
|
if (dryRun) {
|
||||||
|
scriptArgs.push('--dry-run')
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
let bumpVersion = execSync(scriptArgs.join(' '), {encoding: 'UTF-8'})
|
let bumpVersion = execSync(scriptArgs.join(' '), {encoding: 'UTF-8'})
|
||||||
bumpVersion = bumpVersion.substr(bumpVersion.indexOf(':') + 1).trim()
|
bumpVersion = bumpVersion.substr(bumpVersion.indexOf(':') + 1).trim()
|
||||||
let newVersion = `v${bumpVersion}`
|
let newVersion = `v${bumpVersion}`
|
||||||
console.log(`${pass} Successfully bumped version to ${newVersion}`)
|
if (!dryRun) {
|
||||||
|
console.log(`${pass} Successfully bumped version to ${newVersion}`)
|
||||||
|
}
|
||||||
return newVersion
|
return newVersion
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(`${fail} Could not bump version, error was:`, err)
|
console.log(`${fail} Could not bump version, error was:`, err)
|
||||||
|
@ -127,16 +133,17 @@ async function createRelease (branchToTarget, isBeta) {
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
console.log(`${pass} A draft release does not exist; creating one.`)
|
console.log(`${pass} A draft release does not exist; creating one.`)
|
||||||
githubOpts.body = releaseNotes
|
|
||||||
githubOpts.draft = true
|
githubOpts.draft = true
|
||||||
githubOpts.name = `electron ${newVersion}`
|
githubOpts.name = `electron ${newVersion}`
|
||||||
if (isBeta) {
|
if (isBeta) {
|
||||||
githubOpts.body = `Note: This is a beta release. Please file new issues ` +
|
githubOpts.body = `Note: This is a beta release. Please file new issues ` +
|
||||||
`for any bugs you find in it.\n \n This release is published to npm ` +
|
`for any bugs you find in it.\n \n This release is published to npm ` +
|
||||||
`under the beta tag and can be installed via npm install electron@beta, ` +
|
`under the beta tag and can be installed via npm install electron@beta, ` +
|
||||||
`or npm i electron@${newVersion.substr(1)}.`
|
`or npm i electron@${newVersion.substr(1)}.\n \n ${releaseNotes}`
|
||||||
githubOpts.name = `${githubOpts.name}`
|
githubOpts.name = `${githubOpts.name}`
|
||||||
githubOpts.prerelease = true
|
githubOpts.prerelease = true
|
||||||
|
} else {
|
||||||
|
githubOpts.body = releaseNotes
|
||||||
}
|
}
|
||||||
githubOpts.tag_name = newVersion
|
githubOpts.tag_name = newVersion
|
||||||
githubOpts.target_commitish = branchToTarget
|
githubOpts.target_commitish = branchToTarget
|
||||||
|
@ -166,12 +173,37 @@ async function runReleaseBuilds () {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function verifyNewVersion () {
|
||||||
|
let newVersion = await getNewVersion(true)
|
||||||
|
let response = await promptForVersion(newVersion)
|
||||||
|
if (response.match(/^y/i)) {
|
||||||
|
console.log(`${pass} Starting release of ${newVersion}`)
|
||||||
|
} else {
|
||||||
|
console.log(`${fail} Aborting release of ${newVersion}`)
|
||||||
|
process.exit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function promptForVersion (version) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const rl = readline.createInterface({
|
||||||
|
input: process.stdin,
|
||||||
|
output: process.stdout
|
||||||
|
})
|
||||||
|
rl.question(`Do you want to create the release ${version.green} (y/N)? `, (answer) => {
|
||||||
|
rl.close()
|
||||||
|
resolve(answer)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
async function prepareRelease (isBeta, notesOnly) {
|
async function prepareRelease (isBeta, notesOnly) {
|
||||||
let currentBranch = await getCurrentBranch(gitDir)
|
let currentBranch = await getCurrentBranch(gitDir)
|
||||||
if (notesOnly) {
|
if (notesOnly) {
|
||||||
let releaseNotes = await getReleaseNotes(currentBranch)
|
let releaseNotes = await getReleaseNotes(currentBranch)
|
||||||
console.log(`Draft release notes are: ${releaseNotes}`)
|
console.log(`Draft release notes are: ${releaseNotes}`)
|
||||||
} else {
|
} else {
|
||||||
|
await verifyNewVersion()
|
||||||
await createReleaseBranch()
|
await createReleaseBranch()
|
||||||
await createRelease(currentBranch, isBeta)
|
await createRelease(currentBranch, isBeta)
|
||||||
await pushRelease()
|
await pushRelease()
|
||||||
|
|
|
@ -51,8 +51,8 @@ async function getDraftRelease (version, skipValidation) {
|
||||||
return draft
|
return draft
|
||||||
}
|
}
|
||||||
|
|
||||||
async function validateReleaseAssets (release) {
|
async function validateReleaseAssets (release, validatingRelease) {
|
||||||
const requiredAssets = assetsForVersion(release.tag_name).sort()
|
const requiredAssets = assetsForVersion(release.tag_name, validatingRelease).sort()
|
||||||
const extantAssets = release.assets.map(asset => asset.name).sort()
|
const extantAssets = release.assets.map(asset => asset.name).sort()
|
||||||
const downloadUrls = release.assets.map(asset => asset.browser_download_url).sort()
|
const downloadUrls = release.assets.map(asset => asset.browser_download_url).sort()
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ function check (condition, statement, exitIfFail = false) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function assetsForVersion (version) {
|
function assetsForVersion (version, validatingRelease) {
|
||||||
const patterns = [
|
const patterns = [
|
||||||
`electron-${version}-darwin-x64-dsym.zip`,
|
`electron-${version}-darwin-x64-dsym.zip`,
|
||||||
`electron-${version}-darwin-x64-symbols.zip`,
|
`electron-${version}-darwin-x64-symbols.zip`,
|
||||||
|
@ -120,9 +120,11 @@ function assetsForVersion (version) {
|
||||||
`ffmpeg-${version}-linux-x64.zip`,
|
`ffmpeg-${version}-linux-x64.zip`,
|
||||||
`ffmpeg-${version}-mas-x64.zip`,
|
`ffmpeg-${version}-mas-x64.zip`,
|
||||||
`ffmpeg-${version}-win32-ia32.zip`,
|
`ffmpeg-${version}-win32-ia32.zip`,
|
||||||
`ffmpeg-${version}-win32-x64.zip`,
|
`ffmpeg-${version}-win32-x64.zip`
|
||||||
`SHASUMS256.txt`
|
|
||||||
]
|
]
|
||||||
|
if (!validatingRelease) {
|
||||||
|
patterns.push('SHASUMS256.txt')
|
||||||
|
}
|
||||||
return patterns
|
return patterns
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,9 +258,14 @@ async function publishRelease (release) {
|
||||||
|
|
||||||
async function makeRelease (releaseToValidate) {
|
async function makeRelease (releaseToValidate) {
|
||||||
if (releaseToValidate) {
|
if (releaseToValidate) {
|
||||||
console.log(`Validating release ${args.validateRelease}`)
|
if (releaseToValidate === true) {
|
||||||
let release = await getDraftRelease(args.validateRelease)
|
releaseToValidate = pkgVersion
|
||||||
await validateReleaseAssets(release)
|
} else {
|
||||||
|
console.log('Release to validate !=== true')
|
||||||
|
}
|
||||||
|
console.log(`Validating release ${releaseToValidate}`)
|
||||||
|
let release = await getDraftRelease(releaseToValidate)
|
||||||
|
await validateReleaseAssets(release, true)
|
||||||
} else {
|
} else {
|
||||||
checkVersion()
|
checkVersion()
|
||||||
let draftRelease = await getDraftRelease()
|
let draftRelease = await getDraftRelease()
|
||||||
|
|
Loading…
Add table
Reference in a new issue