-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathnotarize.cjs
34 lines (29 loc) · 994 Bytes
/
notarize.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const { notarize } = require("@electron/notarize");
exports.default = async function notarizeMacos(context) {
const { electronPlatformName, appOutDir } = context;
if (electronPlatformName !== "darwin") {
return;
}
console.info("Starting notarization step.");
if (!process.env.CI) {
console.warn("Skipping notarizing step. Packaging is not running in CI");
return;
}
if (
!("APPLE_ID" in process.env && "APPLE_APP_SPECIFIC_PASSWORD" in process.env)
) {
console.warn(
"Skipping notarizing step. APPLE_ID and APPLE_APP_SPECIFIC_PASSWORD env variables must be set",
);
return;
}
const appName = context.packager.appInfo.productFilename;
// These environment variables are set in the GitHub Actions secrets
await notarize({
tool: "notarytool",
appPath: `${appOutDir}/${appName}.app`,
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_APP_SPECIFIC_PASSWORD,
teamId: process.env.APPLE_TEAM_ID,
});
};