build: fail publish when upload fatal errors (#48546)
We logged a fatal error but didn't exit with code 1 so the publish kept going. This was caught by a sanity check later down the release process but would have been quicker to fail out here. Also adds some code to maybe workaround the underlying auth error Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Samuel Attard <sam@electronjs.org>
This commit is contained in:
parent
b09c887302
commit
64fe2aef9a
1 changed files with 8 additions and 1 deletions
|
|
@ -48,7 +48,7 @@ const targetRepo = getRepo();
|
|||
const uploadUrl = `https://uploads.github.com/repos/electron/${targetRepo}/releases/${releaseId}/assets{?name,label}`;
|
||||
let retry = 0;
|
||||
|
||||
const octokit = new Octokit({
|
||||
let octokit = new Octokit({
|
||||
authStrategy: createGitHubTokenStrategy(targetRepo),
|
||||
log: console
|
||||
});
|
||||
|
|
@ -73,6 +73,12 @@ function uploadToGitHub () {
|
|||
console.log(`Error uploading ${fileName} to GitHub, will retry. Error was:`, err);
|
||||
retry++;
|
||||
|
||||
// Reset octokit in case it cached an auth error somehow
|
||||
octokit = new Octokit({
|
||||
authStrategy: createGitHubTokenStrategy(targetRepo),
|
||||
log: console
|
||||
});
|
||||
|
||||
octokit.repos.listReleaseAssets({
|
||||
owner: ELECTRON_ORG,
|
||||
repo: targetRepo,
|
||||
|
|
@ -98,6 +104,7 @@ function uploadToGitHub () {
|
|||
}
|
||||
}).catch((getReleaseErr) => {
|
||||
console.log('Fatal: Unable to get current release assets via getRelease! Error was:', getReleaseErr);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
} else {
|
||||
console.log(`Error retrying uploading ${fileName} to GitHub:`, err);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue