forked from claraverse-space/ClaraVerse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotarize.js
More file actions
54 lines (44 loc) · 1.39 KB
/
Copy pathnotarize.js
File metadata and controls
54 lines (44 loc) · 1.39 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
46
47
48
49
50
51
52
53
54
const { notarize } = require('@electron/notarize');
const path = require('path');
const fs = require('fs');
exports.default = async function notarizing(context) {
const { electronPlatformName, appOutDir } = context;
// Only notarize on macOS
if (electronPlatformName !== 'darwin') {
return;
}
console.log('Notarizing macOS application...');
// Get application name from package.json if not provided
const appName = context.packager.appInfo.productFilename;
const appPath = path.join(appOutDir, `${appName}.app`);
// Check if app exists
if (!fs.existsSync(appPath)) {
console.error(`Cannot find application at: ${appPath}`);
return;
}
// Get credentials from environment variables
const {
APPLE_ID,
APPLE_APP_SPECIFIC_PASSWORD,
APPLE_TEAM_ID
} = process.env;
if (!APPLE_ID || !APPLE_APP_SPECIFIC_PASSWORD || !APPLE_TEAM_ID) {
console.warn('Skipping notarization - missing required environment variables');
return;
}
console.log(`Notarizing ${appName} with Apple ID: ${APPLE_ID}`);
try {
// Start notarization
await notarize({
tool: 'notarytool',
appPath,
appleId: APPLE_ID,
appleIdPassword: APPLE_APP_SPECIFIC_PASSWORD,
teamId: APPLE_TEAM_ID,
});
console.log(`Successfully notarized ${appName}`);
} catch (error) {
console.error('Notarization failed:', error);
throw error;
}
};