element-desktop/scripts/electron_afterSign.js
David Baker a2c5d6176f Initial copy of files from the riot-web repo
None of this will work as it will need tweaking (at the very least
I've not copied the origin migrator because that's had long enough)
but these are files which already existed in their current state and
so don't need re-reviewing.
2019-12-06 18:17:34 +00:00

25 lines
948 B
JavaScript

const { notarize } = require('electron-notarize');
exports.default = async function(context) {
const { electronPlatformName, appOutDir } = context;
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) {
throw new Error("User ID not found. Set NOTARIZE_APPLE_ID.");
}
console.log("Notarising macOS app. This may be some time.");
return await notarize({
appBundleId: 'im.riot.app',
appPath: `${appOutDir}/${appName}.app`,
appleId: userId,
appleIdPassword: '@keychain:NOTARIZE_CREDS',
});
}
};