desktop-release: a DMG notarization upload cut off before Apple had it (abortedUpload) is submitted once more

This commit is contained in:
CRTkafa 2026-10-18 02:11:54 +08:00
parent 45b705ba85
commit 88078f1d7e

View file

@ -517,7 +517,12 @@ async function mac(argv: string[]): Promise<void> {
const updaterSig = signFile(updater);
if (dmgNotary) {
const n = await dmgNotary;
let n = await dmgNotary;
// an upload cut off on the way to Apple (abortedUpload, a reset connection) submitted nothing: send it once more
if (n.code !== 0 && /abortedUpload|connection (was )?reset|timed out|network connection was lost/i.test(n.err + n.out)) {
say('notarytool: the DMG upload was cut off before Apple had it; submitting once more');
n = await runAsync(['xcrun', 'notarytool', 'submit', dmg, '--key', notary!.APPLE_API_KEY_PATH!, '--key-id', notary!.APPLE_API_KEY!, '--issuer', notary!.APPLE_API_ISSUER!, '--wait', '--output-format', 'json'], { timeoutMs: 3_600_000 });
}
const status = (() => { try { return (JSON.parse(n.out) as { status?: string }).status; } catch { return undefined; } })();
if (status !== 'Accepted') fail(`notarization of the DMG: ${status ?? (n.err.trim() || n.out.trim() || `notarytool exited ${n.code} without an answer (killed or timed out): run again; xcrun notarytool history shows the submission`)}`);
say(`DMG notarized in ${(n.ms / 1000).toFixed(0)} s`);