Skip to content

Commit

Permalink
chore: OSX Notarization
Browse files Browse the repository at this point in the history
  • Loading branch information
Miloš Danilov authored and Milos Danilov committed Jan 9, 2020
1 parent cb1c590 commit 830c30b
Show file tree
Hide file tree
Showing 6 changed files with 849 additions and 367 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ addons:
apt:
packages:
- libsecret-1-dev
- icnsutils
- libopenjp2-tools
- graphicsmagick
- xz-utils
artifacts:
Expand Down
24 changes: 24 additions & 0 deletions build-scripts/notarize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const { notarize } = require('electron-notarize');

module.exports = async function (context) {
if (process.platform !== 'darwin') {
return;
}

console.log('Notarizing...');

const appId = context.packager.config.appId;
const appOutDir = context.appOutDir;
const appName = context.packager.appInfo.productFilename;

console.log('appId: ', appId);
console.log('appOutDir: ', appOutDir);
console.log('appName: ', appName);

return await notarize({
appBundleId: appId,
appPath: `${appOutDir}/${appName}.app`,
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_ID_PASSWORD
});
};
11 changes: 9 additions & 2 deletions electron-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ builder.build({
}],
mac: {
target: ["dmg"],
hardenedRuntime: true,
gatekeeperAssess: false,
entitlements: electronDir + "/config/entitlements.mac.plist",
entitlementsInherit: electronDir + "/config/entitlements.mac.plist",
},
win: {
target: ["nsis"],
Expand All @@ -87,8 +91,11 @@ builder.build({
fileAssociations: [{
ext: "cwl",
name: "CWL"
}]

}],
afterSign: projectRoot + "/build-scripts/notarize.js",
dmg: {
sign: false
}
}
});

Expand Down
8 changes: 8 additions & 0 deletions electron/config/entitlements.mac.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
</dict>
</plist>
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"scripts": {
"build": "./node_modules/.bin/rimraf dist ng-dist && yarn run compile:electron && yarn run compile:angular && yarn run package",
"changelog": "./node_modules/.bin/git-changelog",
"whereiam": "dir",
"compile:angular": "node --max-old-space-size=4096 ./node_modules/@angular/cli/bin/ng build -prod -aot",
"compile:electron": "./node_modules/.bin/rimraf electron/dist electron/ng-dist && ./node_modules/.bin/tsc -p electron && node build-scripts/splash-copy.js",
"compile:electron:watch": "./node_modules/.bin/tsc -p electron --watch",
Expand Down Expand Up @@ -91,7 +92,8 @@
"codelyzer": "^4.0.1",
"concurrently": "^3.5.0",
"electron": "1.7.12",
"electron-builder": "^19.56.0",
"electron-builder": "20.44.4",
"electron-notarize": "^0.2.1",
"fs-extra": "^4.0.1",
"git-changelog": "^1.1.2",
"glob": "^7.1.1",
Expand Down
Loading

0 comments on commit 830c30b

Please sign in to comment.