Refine notatize.js and update README.md

This commit is contained in:
Andrew Gundersen 2022-03-10 07:16:42 -06:00
commit 6fb6407f6a
4 changed files with 55 additions and 34 deletions

View file

@ -1,36 +1,41 @@
const exec = require('child_process').exec;
const sign = require("electron-osx-sign").signAsync;
const notarize = require("electron-notarize").notarize;
const path = __dirname + "/Electron.app/Contents/Resources/app/node_modules";
const app = "Electron.app";
const addons = [
`${path}/@crimata/nodeaudio/build/Release/libportaudio.dylib`,
`${path}/@crimata/nodeaudio/build/Release/nodeAudio.node`
];
const runShellCommand = (cmd) => (new Promise((resolve, reject) => {
exec(cmd, (error, stdout, stderr) => {
error ? reject(stderr) : resolve(stdout);
});
}));
const signConfig = {
"app": "Electron.app",
"platform": "darwin",
"binaries": addons,
"app": app,
"hardened-runtime": true,
"gatekeeper-assess": false,
"signature-flags": "library",
"entitlements": "entitlements.plist",
"entitlements-inherit": "entitlements.plist",
"signature-flags": "library",
"gatekeeper-assess": false
};
const notarizeConfig = {
appBundleId: "com.github.Electron",
appPath: "Electron.app",
appPath: app,
appleId: "gundersena@crimata.com",
appleIdPassword: "wdeb-cbcq-rujb-ldgo"
appBundleId: "com.github.Electron",
appleIdPassword: process.env["AC_PASSWORD"]
};
(async function () {
try
{
console.log("Cleaning App...");
await runShellCommand(`xattr -cr ${app}`);
console.log("Signing...");
await sign(signConfig);
console.log("Notarizing...");
await notarize(notarizeConfig);
}
@ -40,15 +45,3 @@ const notarizeConfig = {
}
})();
/* Clear debris from .app before running or it will complain:
* xattr -cr Electron.app
*
* Paste this in terminal to debug electron-osx-sign:
* export DEBUG=electron-osx-sign*
*
* Some important things to note:
* - In order to notarize, you need a valid Apple Developer ID Application * Certificate.
* - All flags in current signing config are required for notarization (to
* my knowledge).
*/