-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotarize.js
More file actions
39 lines (32 loc) · 1.02 KB
/
notarize.js
File metadata and controls
39 lines (32 loc) · 1.02 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
require('dotenv').config();
const fs = require('fs');
const path = require('path');
const { notarize } = require('electron-notarize');
module.exports = async function notarizing(context) {
console.log('Starting with notarizing process...');
const { electronPlatformName, appOutDir } = context;
if (electronPlatformName !== 'darwin') {
return;
}
if (!(process.env.APPLEID && process.env.APPLEIDPASS)) {
console.warn('Skipping MacOS notarization...');
return;
}
const appName = `${context.packager.appInfo.productFilename}.app`;
const appPath = path.join(appOutDir, appName);
if (!fs.existsSync(appPath)) {
throw new Error(`Cannot find application at: ${appPath}`);
}
try {
const notarizeConfig = {
appBundleId: 'app.ssh-git',
appPath,
appleId: process.env.APPLEID,
appleIdPassword: process.env.APPLEIDPASS,
};
await notarize(notarizeConfig);
} catch (error) {
console.error(`Error notarizing: ${error.message}`);
}
console.log('Done notarizing!');
};