fix: retry full json upload step on failure (#1199)

This commit is contained in:
Fabian-Lars
2025-11-17 22:12:11 +01:00
committed by GitHub
parent 2d5d375e87
commit cc981ad2a9
3 changed files with 28 additions and 19 deletions

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -9,7 +9,7 @@ import { getOrCreateRelease } from './create-release';
import { uploadAssets as uploadReleaseAssets } from './upload-release-assets';
import { uploadVersionJSON } from './upload-version-json';
import { buildProject } from './build';
import { execCommand, getInfo, getTargetInfo } from './utils';
import { execCommand, getInfo, getTargetInfo, retry } from './utils';
import type { Artifact, BuildOptions } from './types';
import { uploadWorkflowArtifacts } from './upload-workflow-artifacts';
@@ -208,21 +208,28 @@ async function run(): Promise<void> {
);
if (includeUpdaterJson) {
await uploadVersionJSON(
owner,
repo,
info.version,
body,
tagName,
releaseId,
artifacts,
targetInfo,
info.unzippedSigs,
updaterJsonPreferNsis,
retryAttempts,
githubBaseUrl,
isGitea,
releaseAssetNamePattern,
// Once we start throwing our own errors in this function we may need some custom retry logic.
// We can't retry just the inner asset upload as that may upload an outdated latest.json file.
await retry(
() =>
uploadVersionJSON(
owner,
repo,
info.version,
body,
tagName,
releaseId,
artifacts,
targetInfo,
info.unzippedSigs,
updaterJsonPreferNsis,
retryAttempts,
githubBaseUrl,
isGitea,
releaseAssetNamePattern,
),
// since all jobs try to upload this file it tends to conflict often so we want to retry it at least once.
retryAttempts === 0 ? 1 : retryAttempts,
);
}
} else {

View File

@@ -34,7 +34,7 @@ export async function uploadVersionJSON(
targetInfo: TargetInfo,
unzippedSig: boolean,
updaterJsonPreferNsis: boolean,
retryAttempts: number,
_retryAttempts: number,
githubBaseUrl: string,
isGitea: boolean,
releaseAssetNamePattern?: string,
@@ -335,7 +335,9 @@ export async function uploadVersionJSON(
repo,
releaseId,
[artifact],
retryAttempts,
// The whole step will be retried where `uploadVersionJSON` is called.
// Just in case it's a quick http hickup we retry it once here as well.
1,
githubBaseUrl,
isGitea,
);