Release updates in prep for 3-0-x releases (#12916)
* Add autorelease logic * Fix UnboundLocalError when using s3 upload
This commit is contained in:
parent
d5dfb19508
commit
cc2cd95ec5
4 changed files with 110 additions and 33 deletions
|
@ -6,7 +6,7 @@ const circleCIJobs = [
|
|||
'electron-linux-arm',
|
||||
'electron-linux-arm64',
|
||||
'electron-linux-ia32',
|
||||
'electron-linux-mips64el',
|
||||
// 'electron-linux-mips64el',
|
||||
'electron-linux-x64'
|
||||
]
|
||||
|
||||
|
@ -32,7 +32,7 @@ async function makeRequest (requestOptions, parseResponse) {
|
|||
})
|
||||
}
|
||||
|
||||
async function circleCIcall (buildUrl, targetBranch, job, ghRelease) {
|
||||
async function circleCIcall (buildUrl, targetBranch, job, options) {
|
||||
assert(process.env.CIRCLE_TOKEN, 'CIRCLE_TOKEN not found in environment')
|
||||
console.log(`Triggering CircleCI to run build job: ${job} on branch: ${targetBranch} with release flag.`)
|
||||
let buildRequest = {
|
||||
|
@ -41,12 +41,16 @@ async function circleCIcall (buildUrl, targetBranch, job, ghRelease) {
|
|||
}
|
||||
}
|
||||
|
||||
if (ghRelease) {
|
||||
if (options.ghRelease) {
|
||||
buildRequest.build_parameters.ELECTRON_RELEASE = 1
|
||||
} else {
|
||||
buildRequest.build_parameters.RUN_RELEASE_BUILD = 'true'
|
||||
}
|
||||
|
||||
if (options.automaticRelease) {
|
||||
buildRequest.build_parameters.AUTO_RELEASE = 'true'
|
||||
}
|
||||
|
||||
let circleResponse = await makeRequest({
|
||||
method: 'POST',
|
||||
url: buildUrl,
|
||||
|
@ -61,17 +65,21 @@ async function circleCIcall (buildUrl, targetBranch, job, ghRelease) {
|
|||
console.log(`Check ${circleResponse.build_url} for status. (${job})`)
|
||||
}
|
||||
|
||||
async function buildAppVeyor (targetBranch, ghRelease) {
|
||||
async function buildAppVeyor (targetBranch, options) {
|
||||
console.log(`Triggering AppVeyor to run build on branch: ${targetBranch} with release flag.`)
|
||||
assert(process.env.APPVEYOR_TOKEN, 'APPVEYOR_TOKEN not found in environment')
|
||||
let environmentVariables = {}
|
||||
|
||||
if (ghRelease) {
|
||||
if (options.ghRelease) {
|
||||
environmentVariables.ELECTRON_RELEASE = 1
|
||||
} else {
|
||||
environmentVariables.RUN_RELEASE_BUILD = 'true'
|
||||
}
|
||||
|
||||
if (options.automaticRelease) {
|
||||
environmentVariables.AUTO_RELEASE = 'true'
|
||||
}
|
||||
|
||||
const requestOpts = {
|
||||
url: buildAppVeyorURL,
|
||||
auth: {
|
||||
|
@ -95,13 +103,13 @@ async function buildAppVeyor (targetBranch, ghRelease) {
|
|||
console.log(`AppVeyor release build request successful. Check build status at ${buildUrl}`)
|
||||
}
|
||||
|
||||
function buildCircleCI (targetBranch, ghRelease, job) {
|
||||
function buildCircleCI (targetBranch, options) {
|
||||
const circleBuildUrl = `https://circleci.com/api/v1.1/project/github/electron/electron/tree/${targetBranch}?circle-token=${process.env.CIRCLE_TOKEN}`
|
||||
if (job) {
|
||||
assert(circleCIJobs.includes(job), `Unknown CI job name: ${job}.`)
|
||||
circleCIcall(circleBuildUrl, targetBranch, job, ghRelease)
|
||||
if (options.job) {
|
||||
assert(circleCIJobs.includes(options.job), `Unknown CI job name: ${options.job}.`)
|
||||
circleCIcall(circleBuildUrl, targetBranch, options.job, options)
|
||||
} else {
|
||||
circleCIJobs.forEach((job) => circleCIcall(circleBuildUrl, targetBranch, job, ghRelease))
|
||||
circleCIJobs.forEach((job) => circleCIcall(circleBuildUrl, targetBranch, job, options))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,28 +117,30 @@ function runRelease (targetBranch, options) {
|
|||
if (options.ci) {
|
||||
switch (options.ci) {
|
||||
case 'CircleCI': {
|
||||
buildCircleCI(targetBranch, options.ghRelease, options.job)
|
||||
buildCircleCI(targetBranch, options)
|
||||
break
|
||||
}
|
||||
case 'AppVeyor': {
|
||||
buildAppVeyor(targetBranch, options.ghRelease)
|
||||
buildAppVeyor(targetBranch, options)
|
||||
break
|
||||
}
|
||||
}
|
||||
} else {
|
||||
buildCircleCI(targetBranch, options.ghRelease, options.job)
|
||||
buildAppVeyor(targetBranch, options.ghRelease)
|
||||
buildCircleCI(targetBranch, options)
|
||||
buildAppVeyor(targetBranch, options)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = runRelease
|
||||
|
||||
if (require.main === module) {
|
||||
const args = require('minimist')(process.argv.slice(2), { boolean: 'ghRelease' })
|
||||
const args = require('minimist')(process.argv.slice(2), {
|
||||
boolean: ['ghRelease', 'automaticRelease']
|
||||
})
|
||||
const targetBranch = args._[0]
|
||||
if (args._.length < 1) {
|
||||
console.log(`Trigger CI to build release builds of electron.
|
||||
Usage: ci-release-build.js [--job=CI_JOB_NAME] [--ci=CircleCI|AppVeyor] [--ghRelease] TARGET_BRANCH
|
||||
Usage: ci-release-build.js [--job=CI_JOB_NAME] [--ci=CircleCI|AppVeyor] [--ghRelease] [--automaticRelease] TARGET_BRANCH
|
||||
`)
|
||||
process.exit(0)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue