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,
|
filePath: filePath,
|
||||||
name: fileName
|
name: fileName
|
||||||
}
|
}
|
||||||
github.repos.uploadAsset(githubOpts).then(() => {
|
|
||||||
process.exit()
|
let retry = true
|
||||||
}).catch((err) => {
|
|
||||||
console.log(`Error uploading ${fileName} to GitHub:`, err)
|
function uploadToGitHub () {
|
||||||
process.exitCode = 1
|
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…
Add table
Add a link
Reference in a new issue