-
Notifications
You must be signed in to change notification settings - Fork 272
/
Copy pathafterSign.js
34 lines (28 loc) · 929 Bytes
/
afterSign.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
const { notarize } = require('@electron/notarize');
const { AfterPackContext } = require('electron-builder');
function logAfterSignProgress(msg) {
// biome-ignore lint/suspicious/noConsoleLog: log notarizing progress
console.log(` • [afterSign]: ${msg}`);
}
/**
* @param {AfterPackContext} context
*/
const afterSign = async (context) => {
logAfterSignProgress('Starting...');
const { appOutDir } = context;
const appName = context.packager.appInfo.productFilename;
const shouldNotarize = process.env.NOTARIZE === 'true';
if (!shouldNotarize) {
logAfterSignProgress(
'skipping notarize step as NOTARIZE env flag was not set',
);
return;
}
return await notarize({
appPath: `${appOutDir}/${appName}.app`,
appleId: process.env.APPLE_ID_USERNAME,
appleIdPassword: process.env.APPLE_ID_PASSWORD,
teamId: process.env.APPLE_ID_TEAM_ID,
});
};
module.exports = afterSign;