-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sltt-app): sign and notarize macos application (#28)
What issue(s) is this trying to resolve? * feat(sltt-app): Sign and notarize Mac application #9 How does it all work? * In order for a Mac application to be successfully installed, the app installer must be signed (with a certificate) and notarized (uploaded to Apple to be scanned for viruses, etc.). What particularly has changed? * Description of procedure [HERE](https://docs.google.com/document/d/1Qk-bz-uRPBThCXs2rRfNnr4QIxsC3yNlM_e7eMjGGHs/edit?usp=sharing) * Signing certificate created * .env file with notarization credentials created * package.json "build" object updated with Mac build config Steps for testing 1. yarn build:mac 2. Copy newly created .dmg file to another mac 3. Launch dmg file, drag application icon to Applications folder, launch application, smoke test. ticket: #9 commit-convention: https://www.conventionalcommits.org/en/v1.0.0/ --------- Co-authored-by: Eric Pyle <[email protected]>
- Loading branch information
1 parent
adb1584
commit 48a688a
Showing
6 changed files
with
50 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ node_modules | |
dist | ||
out | ||
*.log* | ||
.env | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
const { notarize } = require('@electron/notarize') | ||
|
||
module.exports = async (context) => { | ||
if (process.platform !== 'darwin') return | ||
console.log('afterSign hook triggered') | ||
|
||
console.log('aftersign hook triggered, start to notarize app.') | ||
require('dotenv').config() | ||
|
||
if (!process.env.CI) { | ||
console.log(`skipping notarizing, not in CI.`) | ||
return | ||
} | ||
const { notarize } = require('@electron/notarize') | ||
|
||
if (!('APPLE_ID' in process.env && 'APPLE_ID_PASS' in process.env)) { | ||
console.warn('skipping notarizing, APPLE_ID and APPLE_ID_PASS env variables must be set.') | ||
exports.default = async function notarizing(context) { | ||
const { electronPlatformName, appOutDir } = context | ||
if (electronPlatformName !== 'darwin') { | ||
return | ||
} | ||
|
||
const appId = 'net.sltt-bible.app' | ||
|
||
const { appOutDir } = context | ||
console.log('notarizing...') | ||
|
||
const appName = context.packager.appInfo.productFilename | ||
|
||
try { | ||
await notarize({ | ||
appBundleId: appId, | ||
appPath: `${appOutDir}/${appName}.app`, | ||
appleId: process.env.APPLE_ID, | ||
appleIdPassword: process.env.APPLEIDPASS | ||
}) | ||
} catch (error) { | ||
console.error(error) | ||
// Get appleId and appleIdPassword from environment variables. | ||
// These values are in the .env file. | ||
// appleId: email address you use to login to App Store Connect | ||
// appleIdPassword: app-specific password generated by appleid.apple.com | ||
const { appleId, appleIdPassword, teamId } = process.env | ||
|
||
if (!appleId || !appleIdPassword || !teamId) { | ||
console.error('Missing Apple ID or Apple ID password or Team ID') | ||
return | ||
} | ||
|
||
console.log(`done notarizing ${appId}.`) | ||
return await notarize({ | ||
appBundleId: 'net.sltt-bible.app', | ||
appPath: `${appOutDir}/${appName}.app`, | ||
appleId, | ||
appleIdPassword, | ||
tool: 'notarytool', | ||
teamId, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters