40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
const { notarize } = require('@electron/notarize');
|
|
|
|
exports.default = async function notarizing(context) {
|
|
const { electronPlatformName, appOutDir } = context;
|
|
|
|
// Only notarize macOS builds
|
|
if (electronPlatformName !== 'darwin') {
|
|
return;
|
|
}
|
|
|
|
// Skip notarization if credentials are not provided
|
|
const appleId = process.env.APPLE_ID;
|
|
const appleIdPassword = process.env.APPLE_ID_PASSWORD;
|
|
const teamId = process.env.APPLE_TEAM_ID;
|
|
|
|
if (!appleId || !appleIdPassword || !teamId) {
|
|
console.log('Skipping notarization: Apple ID credentials not provided');
|
|
return;
|
|
}
|
|
|
|
const appName = context.packager.appInfo.productFilename;
|
|
|
|
console.log(`Notarizing ${appName}...`);
|
|
|
|
try {
|
|
await notarize({
|
|
appBundleId: 'com.karmaa.termix',
|
|
appPath: `${appOutDir}/${appName}.app`,
|
|
appleId: appleId,
|
|
appleIdPassword: appleIdPassword,
|
|
teamId: teamId,
|
|
});
|
|
|
|
console.log(`Successfully notarized ${appName}`);
|
|
} catch (error) {
|
|
console.error('Notarization failed:', error);
|
|
// Don't fail the build if notarization fails
|
|
}
|
|
};
|