diff --git a/tools/desktop-release.ts b/tools/desktop-release.ts index 54cf8e7..0195f7a 100644 --- a/tools/desktop-release.ts +++ b/tools/desktop-release.ts @@ -517,7 +517,12 @@ async function mac(argv: string[]): Promise { 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`);