|
1 | | -const {notarize} = require('electron-notarize'); |
| 1 | +const {notarize} = require("@electron/notarize"); |
2 | 2 |
|
3 | 3 | exports.default = async function notarizing(context) { |
| 4 | + const appName = context.packager.appInfo.productFilename; |
4 | 5 | const {electronPlatformName, appOutDir} = context; |
5 | | - |
6 | | - if (electronPlatformName !== 'darwin') { |
| 6 | + // We skip notarization if the process is not running on MacOS and |
| 7 | + // if the enviroment variable SKIP_NOTARIZE is set to `true` |
| 8 | + // This is useful for local testing where notarization is useless |
| 9 | + if ( |
| 10 | + electronPlatformName !== "darwin" || |
| 11 | + process.env.SKIP_NOTARIZE === "true" |
| 12 | + ) { |
| 13 | + console.log(` • Skipping notarization`); |
7 | 14 | return; |
8 | 15 | } |
9 | 16 |
|
10 | | - const appName = context.packager.appInfo.productFilename; |
| 17 | + // THIS MUST BE THE SAME AS THE `appId` property |
| 18 | + // in your electron builder configuration |
| 19 | + const appId = "FocusAny"; |
| 20 | + |
| 21 | + let appPath = `${appOutDir}/${appName}.app`; |
| 22 | + let {APPLE_ID, APPLE_ID_PASSWORD, APPLE_TEAM_ID} = process.env; |
| 23 | + console.log(` • Notarizing ${appPath}`); |
11 | 24 |
|
12 | 25 | return await notarize({ |
13 | | - appBundleId: 'com.focusany', |
14 | | - appPath: `${appOutDir}/${appName}.app`, |
15 | | - appleId: 'your-apple-id@example.com', |
16 | | - appleIdPassword: 'your-app-specific-password', |
| 26 | + tool: "notarytool", |
| 27 | + appBundleId: appId, |
| 28 | + appPath, |
| 29 | + appleId: APPLE_ID, |
| 30 | + appleIdPassword: APPLE_ID_PASSWORD, |
| 31 | + teamId: APPLE_TEAM_ID, |
17 | 32 | }); |
18 | 33 | }; |
0 commit comments