chore: update release scripts to support sudowoodo (#14170)

Backports the totality of our release script changes to support sudowoodo. Also backports changes that have been made to a few other release script files in master after 3-0-x was cut with the purpose of keeping them in sync.
This commit is contained in:
Shelley Vohr 2018-08-17 12:01:10 -07:00 committed by GitHub
parent 44b0245ac4
commit 2ecdf4a0eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 272 additions and 104 deletions

View file

@ -1,18 +1,23 @@
if (!process.env.CI) require('dotenv-safe').load()
const GitHub = require('github')
const github = new GitHub()
github.authenticate({type: 'token', token: process.env.ELECTRON_GITHUB_TOKEN})
if (process.argv.length < 5) {
if (process.argv.length < 6) {
console.log('Usage: upload-to-github filePath fileName releaseId')
process.exit(1)
}
let filePath = process.argv[2]
let fileName = process.argv[3]
let releaseId = process.argv[4]
let releaseVersion = process.argv[5]
const targetRepo = releaseVersion.indexOf('nightly') > 0 ? 'nightlies' : 'electron'
let githubOpts = {
owner: 'electron',
repo: 'electron',
repo: targetRepo,
id: releaseId,
filePath: filePath,
name: fileName
@ -34,7 +39,7 @@ function uploadToGitHub () {
console.log(`${fileName} already exists; will delete before retrying upload.`)
github.repos.deleteAsset({
owner: 'electron',
repo: 'electron',
repo: targetRepo,
id: existingAssets[0].id
}).then(uploadToGitHub).catch(uploadToGitHub)
} else {