element-web/scripts/electron_afterSign.js

26 lines
844 B
JavaScript
Raw Normal View History

2019-10-09 15:29:24 +00:00
const { notarize } = require('electron-notarize');
exports.default = async function(context) {
2019-10-09 15:40:31 +00:00
const { electronPlatformName, appOutDir } = context;
2019-10-09 15:29:24 +00:00
if (electronPlatformName !== 'darwin') {
return;
}
// 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) {
throw new Exception("User ID not found. Set NOTARIZE_APPLE_ID.");
}
2019-10-09 15:40:31 +00:00
2019-10-09 15:29:24 +00:00
const appName = context.packager.appInfo.productFilename;
2019-10-09 15:40:31 +00:00
2019-10-09 15:29:24 +00:00
return await notarize({
appBundleId: 'im.riot.app',
appPath: `${appOutDir}/${appName}.app`,
appleId: userId,
2019-10-10 10:53:49 +00:00
appleIdPassword: '@keychain:NOTARIZE_CREDS',
2019-10-09 15:29:24 +00:00
});
};