-
-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathafterSign.js
More file actions
44 lines (36 loc) · 1.23 KB
/
afterSign.js
File metadata and controls
44 lines (36 loc) · 1.23 KB
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
const fs = require('fs');
const path = require('path');
module.exports = async function (params) {
console.log('afterSign hook triggered', params);
// Only notarize the app on Mac OS only.
if (params.electronPlatformName !== 'darwin') {
console.log('Skipping notarization - not macOS');
return;
}
let electronNotarize;
try {
electronNotarize = require('electron-notarize');
} catch (error) {
console.warn('electron-notarize not available; skipping notarization.');
return;
}
// Same appId in electron-builder.
let appId = 'ninja.vdo'
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 electronNotarize.notarize({
appBundleId: appId,
appPath: appPath,
appleId: process.env.appleId,
teamId: process.env.teamId,
appleIdPassword: process.env.appleIdPassword,
});
} catch (error) {
console.error(error);
}
console.log(`Done notarizing ${appId}`);
};