-
Notifications
You must be signed in to change notification settings - Fork 9
/
notarize.js
40 lines (34 loc) · 1.14 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
const fs = require("fs");
const path = require("path");
require("dotenv").config();
var electron_notarize = require("electron-notarize");
module.exports = async function (params) {
// Only notarize the app on Mac OS only.
if (process.platform !== "darwin") {
console.log(
"No notarization needed for current platform. This process is only intended for macOS."
);
return;
}
console.log("afterSign hook triggered", params);
// Same appId in electron-builder.
let appId = "com.fairdataihub.sodaforsparc";
let appPath = path.join(params.appOutDir, `${params.packager.appInfo.productFilename}.app`);
if (!fs.existsSync(appPath)) {
throw new Error(`Cannot find application at: ${appPath}`);
}
console.log(`Notarizing ${appId} found at ${appPath}`);
try {
await electron_notarize.notarize({
tool: "notarytool",
appBundleId: appId,
appPath: appPath,
appleId: process.env.appleId,
appleIdPassword: process.env.appleIdPassword,
teamId: "7KPPP4K323",
});
} catch (error) {
console.error(`Error notarizing ${appId}: ${error}`);
}
console.log(`Done notarizing ${appId}`);
};