diff --git a/packages/keepkey-desktop/package.json b/packages/keepkey-desktop/package.json index cf417073c..8d0208b88 100644 --- a/packages/keepkey-desktop/package.json +++ b/packages/keepkey-desktop/package.json @@ -26,7 +26,6 @@ "build": { "appId": "com.keepkey.desktop", "productName": "KeepKey Desktop", - "afterSign": "./scripts/afterSign.js", "generateUpdatesFilesForAllChannels": true, "publish": "github", "files": [ @@ -49,6 +48,9 @@ "entitlements": "entitlements.mac.plist", "entitlementsInherit": "entitlements.mac.plist", "mergeASARs": false, + "notarize": { + "teamId": "DR57X8Z394" + }, "target": [ { "target": "dmg", diff --git a/packages/keepkey-desktop/scripts/afterSign.js b/packages/keepkey-desktop/scripts/afterSign.js index 8526d54d2..d2b8e125d 100644 --- a/packages/keepkey-desktop/scripts/afterSign.js +++ b/packages/keepkey-desktop/scripts/afterSign.js @@ -1,31 +1,38 @@ -require('dotenv').config() -const { notarize } = require('@electron/notarize') +require('dotenv').config(); +const { notarize } = require('@electron/notarize'); -// const isSet = value => value && value !== 'false' - -// electron-build hook to be used in electron-build pipeline in the future -// =========================================================================== -// Note: for now we don't use this at the moment. -// Run ./notarize-cli.js instead exports.default = async function notarizing(context) { - const { electronPlatformName, appOutDir } = context - if (electronPlatformName !== 'darwin') return - // skip notarization if secrets are not present in env - if (!process.env.APPLE_ID_PASSWORD || !process.env.APPLE_ID) { - console.log('Skipping notarizing, since secrets are not present in env.') - return + const { electronPlatformName, appOutDir } = context; + if (electronPlatformName !== 'darwin') return; + + console.log('Starting notarization process...'); + console.log('Environment Variables:'); + console.log('APPLE_ID:', process.env.APPLE_ID ? 'present' : 'missing'); + console.log('APPLE_APP_SPECIFIC_PASSWORD:', process.env.APPLE_APP_SPECIFIC_PASSWORD ? 'present' : 'missing'); + + if (!process.env.APPLE_ID || !process.env.APPLE_APP_SPECIFIC_PASSWORD) { + console.log('Skipping notarizing, since secrets are not present in env.'); + return; } - const appName = context.packager.appInfo.productFilename - const appPath = `${appOutDir}/${appName}.app` // Correct the path based on actual output directory - console.log('app path:', appPath) - console.log('cwd', __dirname) - return notarize({ - appBundleId: 'com.keepkey.desktop', - appPath, - appleId: process.env.APPLE_ID, - appleIdPassword: process.env.APPLE_APP_SPECIFIC_PASSWORD, - tool: 'notarytool', - teamId: 'DR57X8Z394', - }) -} + const appName = context.packager.appInfo.productFilename; + const appPath = `${appOutDir}/${appName}.app`; + + console.log('App Name:', appName); + console.log('App Path:', appPath); + console.log('Current Working Directory:', __dirname); + + try { + await notarize({ + appBundleId: 'com.keepkey.desktop', + appPath, + appleId: process.env.APPLE_ID, + appleIdPassword: process.env.APPLE_APP_SPECIFIC_PASSWORD, + tool: 'notarytool', + teamId: 'DR57X8Z394', + }); + console.log('Notarization successful'); + } catch (error) { + console.error('Error during notarization:', error); + } +};