Add success message
Also increase retries to 5 attempts.
This commit is contained in:
parent
54563dc94c
commit
0ae12c2b3d
1 changed files with 8 additions and 3 deletions
|
@ -2,6 +2,10 @@ const GitHub = require('github')
|
|||
const github = new GitHub()
|
||||
github.authenticate({type: 'token', token: process.env.ELECTRON_GITHUB_TOKEN})
|
||||
|
||||
if (process.argv.length < 5) {
|
||||
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]
|
||||
|
@ -14,15 +18,16 @@ let githubOpts = {
|
|||
name: fileName
|
||||
}
|
||||
|
||||
let retry = true
|
||||
let retry = 0
|
||||
|
||||
function uploadToGitHub () {
|
||||
github.repos.uploadAsset(githubOpts).then(() => {
|
||||
console.log(`Successfully uploaded ${fileName} to GitHub.`)
|
||||
process.exit()
|
||||
}).catch((err) => {
|
||||
if (retry) {
|
||||
if (retry < 4) {
|
||||
console.log(`Error uploading ${fileName} to GitHub, will retry. Error was:`, err)
|
||||
retry = false
|
||||
retry++
|
||||
uploadToGitHub()
|
||||
} else {
|
||||
console.log(`Error retrying uploading ${fileName} to GitHub:`, err)
|
||||
|
|
Loading…
Reference in a new issue