fix: Improve macOS support
This commit is contained in:
@@ -1,12 +1,25 @@
|
|||||||
const { notarize } = require('@electron/notarize');
|
const { notarize } = require('@electron/notarize');
|
||||||
|
|
||||||
exports.default = async function notarizing(context) {
|
exports.default = async function notarizing(context) {
|
||||||
const { electronPlatformName, appOutDir } = context;
|
const { electronPlatformName, appOutDir, packager } = context;
|
||||||
|
|
||||||
|
// Skip notarization for non-macOS platforms
|
||||||
if (electronPlatformName !== 'darwin') {
|
if (electronPlatformName !== 'darwin') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip notarization for Mac App Store builds (MAS)
|
||||||
|
// MAS builds are notarized by Apple during App Store review
|
||||||
|
const target = packager.platformSpecificBuildOptions.target || [];
|
||||||
|
const isMasBuild = Array.isArray(target)
|
||||||
|
? target.some(t => t.target === 'mas' || t === 'mas')
|
||||||
|
: target === 'mas';
|
||||||
|
|
||||||
|
if (isMasBuild || appOutDir.includes('mas')) {
|
||||||
|
console.log('Skipping notarization for Mac App Store build');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const appName = context.packager.appInfo.productFilename;
|
const appName = context.packager.appInfo.productFilename;
|
||||||
const appPath = `${appOutDir}/${appName}.app`;
|
const appPath = `${appOutDir}/${appName}.app`;
|
||||||
|
|
||||||
@@ -14,10 +27,13 @@ exports.default = async function notarizing(context) {
|
|||||||
const appleIdPassword = process.env.APPLE_APP_SPECIFIC_PASSWORD;
|
const appleIdPassword = process.env.APPLE_APP_SPECIFIC_PASSWORD;
|
||||||
const teamId = process.env.APPLE_TEAM_ID;
|
const teamId = process.env.APPLE_TEAM_ID;
|
||||||
|
|
||||||
|
// Skip if credentials not provided (for unsigned builds)
|
||||||
if (!appleId || !appleIdPassword || !teamId) {
|
if (!appleId || !appleIdPassword || !teamId) {
|
||||||
|
console.log('Skipping notarization: credentials not provided');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('Starting notarization process...');
|
||||||
try {
|
try {
|
||||||
await notarize({
|
await notarize({
|
||||||
appPath: appPath,
|
appPath: appPath,
|
||||||
@@ -25,7 +41,9 @@ exports.default = async function notarizing(context) {
|
|||||||
appleIdPassword: appleIdPassword,
|
appleIdPassword: appleIdPassword,
|
||||||
teamId: teamId,
|
teamId: teamId,
|
||||||
});
|
});
|
||||||
|
console.log('Notarization completed successfully');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error('Notarization failed:', error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user