Fully notarize universal dmg instead of stapling

This commit is contained in:
Fedor Indutny 2022-04-05 17:56:53 -07:00 committed by GitHub
parent b8c1faf086
commit 11d54f6769
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 11 deletions

View file

@ -2,11 +2,11 @@
// SPDX-License-Identifier: AGPL-3.0-only
import type { BuildResult } from 'electron-builder';
import { afterAllArtifactBuild as stapleNotarization } from './staple-notarization';
import { afterAllArtifactBuild as notarizeUniversalDMG } from './notarize-universal-dmg';
export async function afterAllArtifactBuild(
result: BuildResult
): Promise<Array<string>> {
await stapleNotarization(result);
await notarizeUniversalDMG(result);
return [];
}

View file

@ -3,7 +3,7 @@
import type { BuildResult } from 'electron-builder';
import { stapleApp } from 'electron-notarize';
import { notarize } from 'electron-notarize';
import * as packageJson from '../../package.json';
@ -50,14 +50,19 @@ export async function afterAllArtifactBuild({
}
const artifactsToStaple = artifactPaths.filter(artifactPath =>
/\.(zip|dmg)$/.test(artifactPath)
/^.*mac-universal.*\.dmg$/.test(artifactPath)
);
for (const artifactPath of artifactsToStaple) {
console.log(`Stapling notariation for: ${artifactPath}`);
// eslint-disable-next-line no-await-in-loop
await stapleApp({
appPath: artifactPath,
});
if (artifactsToStaple.length !== 1) {
console.log(`notarize: Skipping, too many dmgs ${artifactsToStaple}`);
return;
}
const [dmgPath] = artifactsToStaple;
console.log(`Notarizing dmg: ${dmgPath}`);
await notarize({
appBundleId,
appPath: dmgPath,
appleId,
appleIdPassword,
});
}