-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathnotarize.js
More file actions
45 lines (37 loc) · 1.36 KB
/
Copy pathnotarize.js
File metadata and controls
45 lines (37 loc) · 1.36 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
45
// scripts/notarize.js
const { notarize } = require('@electron/notarize');
require('dotenv').config();
exports.default = async function notarizeApp(context) {
const { electronPlatformName, appOutDir, packager } = context;
if (electronPlatformName !== 'darwin') return;
const skipNotarization = ['1', 'true', 'yes'].includes(
String(process.env.SIGNBOARD_SKIP_NOTARIZATION || '').toLowerCase()
);
if (skipNotarization) {
console.warn('Skipping notarization: SIGNBOARD_SKIP_NOTARIZATION is enabled.');
return;
}
const appName = packager.appInfo.productFilename;
const appleId = process.env.APPLE_ID;
const appleIdPass = process.env.APPLE_APP_SPECIFIC_PASSWORD;
const teamId = process.env.APPLE_TEAM_ID; // REQUIRED for Apple ID + password
if (!appleId || !appleIdPass) {
console.warn('Skipping notarization: APPLE_ID and/or APPLE_APP_SPECIFIC_PASSWORD not set.');
return;
}
console.log(`Notarizing ${appName} with Apple ID ${appleId}...`);
try {
await notarize({
appBundleId: packager.appInfo.appId,
appPath: `${appOutDir}/${appName}.app`,
appleId,
appleIdPassword: appleIdPass,
teamId,
tool: 'notarytool', // modern replacement for altool
});
console.log(`Notarization complete: ${appName}`);
} catch (error) {
console.error('Notarization failed:', error);
throw error;
}
};