Repository navigation
Expand file tree
/
Copy pathnotarize.js
More file actions
50 lines (42 loc) · 1.51 KB
/
Copy pathnotarize.js
File metadata and controls
50 lines (42 loc) · 1.51 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
const { notarize } = require('@electron/notarize');
const path = require('path');
/**
* Notarize the macOS application with Apple
* @param {Object} params - Build parameters from electron-builder
* @param {string} params.electronPlatformName - Platform name (darwin, win32, linux)
* @param {string} params.appOutDir - Output directory of the built app
*/
module.exports = async function (params) {
const { electronPlatformName, appOutDir } = params;
// Only notarize macOS builds
if (electronPlatformName !== 'darwin') {
console.log('Skipping notarization: not a macOS build');
return;
}
// Validate required environment variables
const requiredEnvVars = ['APPLE_ID', 'APPLE_ID_PASSWORD', 'APPLE_TEAM_ID'];
const missingVars = requiredEnvVars.filter((varName) => !process.env[varName]);
if (missingVars.length > 0) {
console.warn(
`Skipping notarization: missing environment variables: ${missingVars.join(', ')}`
);
return;
}
const appName = 'CryptoCast';
const appPath = path.join(appOutDir, `${appName}.app`);
console.log('Starting notarization process...');
console.log(`App path: ${appPath}`);
try {
await notarize({
appBundleId: 'com.cryptocast.desktop',
appPath,
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_ID_PASSWORD,
teamId: process.env.APPLE_TEAM_ID,
});
console.log('Notarization completed successfully!');
} catch (error) {
console.error('Notarization failed:', error.message);
throw error;
}
};