-
Notifications
You must be signed in to change notification settings - Fork 0
/
notarization-stg.js
39 lines (32 loc) · 1.19 KB
/
notarization-stg.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
// See: https://medium.com/@TwitterArchiveEraser/notarize-electron-apps-7a5f988406db
const fs = require('fs');
const path = require('path');
// eslint-disable-next-line camelcase
const electron_notarize = require('electron-notarize');
// eslint-disable-next-line space-before-function-paren
module.exports = async function (params) {
// Only notarize the app on Mac OS only.
if (process.platform !== 'darwin') {
return;
}
console.log('afterSign hook triggered', params);
// Same appId in electron-builder.
let appId = 'com.mydomain.electron-vue-ts';
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({
appBundleId: appId,
appPath: appPath,
ascProvider: 'your appIds ascProvider', // your appId's ascProvider
appleId: 'your appId', // your appId
appleIdPassword: 'your appleId password' // your appleId password
});
} catch (error) {
console.error(error);
}
console.log(`Done notarizing ${appId}`);
};