oxen-electron-gui-wallet/build/notarize.js

47 lines
1.3 KiB
JavaScript
Raw Normal View History

2020-03-03 04:16:23 +01:00
require("dotenv").config();
const { notarize } = require("electron-notarize");
2019-10-15 06:15:46 +02:00
/*
Pre-requisites: https://github.com/electron/electron-notarize#prerequisites
1. Generate an app specific password
2019-12-17 01:16:07 +01:00
2. Add SIGNING_APPLE_ID, SIGNING_APP_PASSWORD, SIGNING_TEAM_ID to .env file in the root directory (where quasar.conf.js is located)
2019-10-15 06:15:46 +02:00
*/
2019-12-17 01:16:07 +01:00
/*
Notarizing: https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/
*/
2020-03-03 04:16:23 +01:00
const log = msg => console.log(`\n${msg}`);
const isEmpty = v => !v || v.length === 0;
2019-12-17 01:16:07 +01:00
2020-03-03 04:16:23 +01:00
exports.default = async function notarizing(context) {
const { electronPlatformName, appOutDir } = context;
if (electronPlatformName !== "darwin") {
return;
}
log("Notarizing mac application");
2019-10-15 06:15:46 +02:00
2020-03-03 04:16:23 +01:00
const appName = context.packager.appInfo.productFilename;
2021-01-06 06:26:42 +01:00
const {
SIGNING_APPLE_ID,
SIGNING_APP_PASSWORD,
SIGNING_TEAM_ID
} = process.env;
2019-10-15 06:15:46 +02:00
2020-03-03 04:16:23 +01:00
if (isEmpty(SIGNING_APPLE_ID) || isEmpty(SIGNING_APP_PASSWORD)) {
2021-01-06 06:26:42 +01:00
log(
"SIGNING_APPLE_ID or SIGNING_APP_PASSWORD not set.\nTerminating noratization."
);
2020-03-03 04:16:23 +01:00
return;
}
2019-12-17 01:16:07 +01:00
2020-03-03 04:16:23 +01:00
const options = {
tool: "notarytool",
2020-03-03 04:16:23 +01:00
appPath: `${appOutDir}/${appName}.app`,
appleId: SIGNING_APPLE_ID,
appleIdPassword: SIGNING_APP_PASSWORD
};
if (!isEmpty(SIGNING_TEAM_ID)) options.teamId = SIGNING_TEAM_ID;
2020-03-03 04:16:23 +01:00
return notarize(options);
};