-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathnotarize.js
58 lines (52 loc) · 1.43 KB
/
notarize.js
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
require("dotenv").config();
const { notarize } = require("@electron/notarize");
exports.default = async function notarizing(context) {
const { electronPlatformName, appOutDir } = context;
if (electronPlatformName !== "darwin") {
console.info(" • notarize skipped: not macOS platform", {
electronPlatformName,
});
return;
}
const {
APPLE_ID,
APPLE_ID_PASSWORD,
APPLE_ID_TEAM,
CSC_IDENTITY_AUTO_DISCOVERY,
} = process.env;
if (
!APPLE_ID ||
!APPLE_ID_PASSWORD ||
!APPLE_ID_TEAM ||
CSC_IDENTITY_AUTO_DISCOVERY === "false"
) {
console.info(
" • notarize skipped: missing required environment variables or identity discovery disabled",
{
APPLE_ID: !!APPLE_ID,
APPLE_ID_PASSWORD: !!APPLE_ID_PASSWORD,
APPLE_ID_TEAM: !!APPLE_ID_TEAM,
CSC_IDENTITY_AUTO_DISCOVERY,
}
);
return;
}
const appName = context.packager.appInfo.productFilename;
console.info(" • notarize application");
try {
await notarize({
// appBundleId,
appPath: `${appOutDir}/${appName}.app`,
appleId: APPLE_ID,
appleIdPassword: APPLE_ID_PASSWORD,
teamId: APPLE_ID_TEAM,
tool: "notarytool",
});
console.info(" • notarizing succeeded ✅");
} catch (error) {
console.error(" • fail notarizing 🚨");
console.error(error);
} finally {
console.info(" • notarizing process completed");
}
};