зеркало из https://github.com/electron/electron.git
make target branch name mandatory and specific ci job optional
add it as an npm script `npm run mock-release -- TARGET_BRANCH`
This commit is contained in:
Родитель
63632f1137
Коммит
85a811db55
|
@ -53,6 +53,7 @@
|
|||
"create-api-json": "electron-docs-linter docs --outfile=out/electron-api.json --version=$npm_package_version",
|
||||
"create-typescript-definitions": "npm run create-api-json && electron-typescript-definitions --in=out/electron-api.json --out=out/electron.d.ts",
|
||||
"merge-release": "node ./script/merge-release.js",
|
||||
"mock-release": "node ./script/ci-release-build.js",
|
||||
"preinstall": "node -e 'process.exit(0)'",
|
||||
"publish-to-npm": "node ./script/publish-to-npm.js",
|
||||
"prepack": "check-for-leaks",
|
||||
|
|
|
@ -9,40 +9,48 @@ const ciJobs = [
|
|||
'electron-linux-arm'
|
||||
]
|
||||
|
||||
const CIcall = (buildUrl, targetBranch, job) => {
|
||||
console.log(`Triggering CircleCI to run build job: ${job} on branch: ${targetBranch} with release flag.`)
|
||||
|
||||
request({
|
||||
method: 'POST',
|
||||
url: buildUrl,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
'build_parameters': {
|
||||
'RUN_RELEASE_BUILD': 'true',
|
||||
'CIRCLE_JOB': job
|
||||
}
|
||||
})
|
||||
}, (err, res, body) => {
|
||||
if (!err && res.statusCode >= 200 && res.statusCode < 300) {
|
||||
const build = JSON.parse(body)
|
||||
console.log(`Check ${build.build_url} for status. (${job})`)
|
||||
} else {
|
||||
console.log('Error: ', err || JSON.parse(res.body), job)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (args._.length < 1) {
|
||||
console.log(`Trigger Circle CI to build release builds of electron.
|
||||
Usage: ci-release-build.js [--branch=TARGET_BRANCH] CI_JOB_NAME
|
||||
Usage: ci-release-build.js [--job=CI_JOB_NAME] TARGET_BRANCH
|
||||
`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const targetBranch = args['branch'] || 'master'
|
||||
const ciJob = args._[0]
|
||||
assert(ciJobs.includes(ciJob), `Unknown ci job name: ${ciJob}.`)
|
||||
assert(process.env.CIRCLE_TOKEN, 'CIRCLE_TOKEN not found in environment')
|
||||
|
||||
const circleBuildURL = `https://circleci.com/api/v1.1/project/github/electron/electron/tree/${targetBranch}?circle-token=${process.env.CIRCLE_TOKEN}`
|
||||
const targetBranch = args._[0]
|
||||
const job = args['job']
|
||||
const circleBuildUrl = `https://circleci.com/api/v1.1/project/github/electron/electron/tree/${targetBranch}?circle-token=${process.env.CIRCLE_TOKEN}`
|
||||
|
||||
console.log(`Triggering CircleCI to run build job: ${ciJob} against branch: ${targetBranch} with release flag.`)
|
||||
|
||||
request({
|
||||
method: 'POST',
|
||||
url: circleBuildURL,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
'build_parameters': {
|
||||
'RUN_RELEASE_BUILD': 'true',
|
||||
'CIRCLE_JOB': ciJob
|
||||
}
|
||||
})
|
||||
}, (err, res, body) => {
|
||||
if (!err && body) {
|
||||
const build = JSON.parse(body)
|
||||
console.log(`check ${build.build_url} for status`)
|
||||
} else {
|
||||
console.log('error', err)
|
||||
}
|
||||
})
|
||||
if (job) {
|
||||
assert(ciJobs.includes(job), `Unknown CI job name: ${job}.`)
|
||||
CIcall(circleBuildUrl, targetBranch, job)
|
||||
} else {
|
||||
ciJobs.forEach((job) => CIcall(circleBuildUrl, targetBranch, job))
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче