Skip to content

Commit

Permalink
feat(project): notarize macos distro
Browse files Browse the repository at this point in the history
Closes #1572
  • Loading branch information
barmac committed Nov 14, 2019
1 parent d1c26cb commit c2ea52a
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 0 deletions.
12 changes: 12 additions & 0 deletions build/entitlements.mac.inherit.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?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-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
</dict>
</plist>
3 changes: 3 additions & 0 deletions electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
}
],
"afterPack": "./tasks/after-pack.js",
"afterSign": "./tasks/after-sign.js",
"afterAllArtifactBuild": "./tasks/after-all-artifact-build.js",
"win": {
"target": [
Expand All @@ -31,6 +32,8 @@
]
},
"mac": {
"hardenedRuntime": true,
"entitlements": "./build/entitlements.mac.inherit.plist",
"target": "dmg"
},
"fileAssociations": [
Expand Down
20 changes: 20 additions & 0 deletions tasks/after-sign.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership.
*
* Camunda licenses this file to you under the MIT; you may not use this file
* except in compliance with the MIT License.
*/

module.exports = async function(context) {

const handlers = [
require('./after-sign/notarize')
];

for (const handler of handlers) {
await handler(context);
}
};
54 changes: 54 additions & 0 deletions tasks/after-sign/notarize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership.
*
* Camunda licenses this file to you under the MIT; you may not use this file
* except in compliance with the MIT License.
*/

const { notarize } = require('electron-notarize');

module.exports = async function(context) {
const {
electronPlatformName,
appOutDir
} = context;

if (electronPlatformName !== 'darwin') {
return;
}

const {
APPLE_DEVELOPER_ID: appleId,
APPLE_DEVELOPER_ID_PASSWORD: appleIdPassword
} = process.env;

// skip notarization if credentials weren't provided
if (!appleId || !appleIdPassword) {
console.log(' • skipping notarization due to missing credentials');

return;
}

const {
productFilename: appName,
info: {
config: {
appId
}
}
} = context.packager.appInfo;

const appPath = `${appOutDir}/${appName}.app`;

console.log(` • notarizing app from path: ${appPath}`);

return await notarize({
appBundleId: appId,
appPath,
appleId,
appleIdPassword
});
};

0 comments on commit c2ea52a

Please sign in to comment.