2022-11-08 10:59:42 +01:00
|
|
|
const { notarize } = require('@electron/notarize');
|
2019-12-06 19:17:34 +01:00
|
|
|
|
2022-05-27 00:05:59 +02:00
|
|
|
let warned = false;
|
2019-12-06 19:17:34 +01:00
|
|
|
exports.default = async function(context) {
|
|
|
|
const { electronPlatformName, appOutDir } = context;
|
2020-03-11 20:21:14 +01:00
|
|
|
const appId = context.packager.info.appInfo.id;
|
2019-12-06 19:17:34 +01:00
|
|
|
|
|
|
|
if (electronPlatformName === 'darwin') {
|
|
|
|
const appName = context.packager.appInfo.productFilename;
|
|
|
|
// We get the password from keychain. The keychain stores
|
|
|
|
// user IDs too, but apparently altool can't get the user ID
|
|
|
|
// from the keychain, so we need to get it from the environment.
|
|
|
|
const userId = process.env.NOTARIZE_APPLE_ID;
|
|
|
|
if (userId === undefined) {
|
2022-05-27 00:05:59 +02:00
|
|
|
if (!warned) {
|
|
|
|
console.log("*************************************");
|
|
|
|
console.log("* NOTARIZE_APPLE_ID is not set. *");
|
|
|
|
console.log("* This build will NOT be notarised. *");
|
|
|
|
console.log("*************************************");
|
|
|
|
warned = true;
|
|
|
|
}
|
2019-12-13 12:21:34 +01:00
|
|
|
return;
|
2019-12-06 19:17:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
console.log("Notarising macOS app. This may be some time.");
|
|
|
|
return await notarize({
|
2020-03-11 20:21:14 +01:00
|
|
|
appBundleId: appId,
|
2019-12-06 19:17:34 +01:00
|
|
|
appPath: `${appOutDir}/${appName}.app`,
|
|
|
|
appleId: userId,
|
|
|
|
appleIdPassword: '@keychain:NOTARIZE_CREDS',
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|