Add logic to retry github uploads
When doing release, sometimes the GitHub upload fails, so try to retry it once before bailing.
This commit is contained in:
parent
d7aa0b0ddb
commit
54563dc94c
1 changed files with 19 additions and 6 deletions
|
@ -13,9 +13,22 @@ let githubOpts = {
|
|||
filePath: filePath,
|
||||
name: fileName
|
||||
}
|
||||
github.repos.uploadAsset(githubOpts).then(() => {
|
||||
process.exit()
|
||||
}).catch((err) => {
|
||||
console.log(`Error uploading ${fileName} to GitHub:`, err)
|
||||
process.exitCode = 1
|
||||
})
|
||||
|
||||
let retry = true
|
||||
|
||||
function uploadToGitHub () {
|
||||
github.repos.uploadAsset(githubOpts).then(() => {
|
||||
process.exit()
|
||||
}).catch((err) => {
|
||||
if (retry) {
|
||||
console.log(`Error uploading ${fileName} to GitHub, will retry. Error was:`, err)
|
||||
retry = false
|
||||
uploadToGitHub()
|
||||
} else {
|
||||
console.log(`Error retrying uploading ${fileName} to GitHub:`, err)
|
||||
process.exitCode = 1
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
uploadToGitHub()
|
||||
|
|
Loading…
Reference in a new issue