diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2024-04-24 15:00:49 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2024-04-25 10:06:16 +0200 |
| commit | c94fc08e0a9d65953f1866ed4463009b7d63d2d9 (patch) | |
| tree | 93161cc0803120810cd0992a4c76969326ba8c62 | |
| parent | 0bd70fbeac85492503592202fd118d6e90199769 (diff) | |
| download | mullvadvpn-c94fc08e0a9d65953f1866ed4463009b7d63d2d9.tar.xz mullvadvpn-c94fc08e0a9d65953f1866ed4463009b7d63d2d9.zip | |
Fix notarization issues after upgrading electron-builder to 24.13.3
To fix issues with electron-builder and @electron/notarize this commit:
* Replaces old notarization code with built-in solution in
electron-builder
* Moves notarization of pkg to build.sh
| -rwxr-xr-x | build.sh | 12 | ||||
| -rw-r--r-- | gui/package-lock.json | 1 | ||||
| -rw-r--r-- | gui/package.json | 1 | ||||
| -rw-r--r-- | gui/tasks/distribution.js | 22 |
4 files changed, 13 insertions, 23 deletions
@@ -354,6 +354,18 @@ if [[ "$SIGN" == "true" && "$(uname -s)" == "MINGW"* ]]; then done fi +# notarize installer on macOS +if [[ "$NOTARIZE" == "true" && "$(uname -s)" == "Darwin" ]]; then + log_info "Notarizing pkg" + xcrun notarytool submit dist/*"$PRODUCT_VERSION"*.pkg \ + --keychain "$NOTARIZE_KEYCHAIN" \ + --keychain-profile "$NOTARIZE_KEYCHAIN_PROFILE" \ + --wait + + log_info "Stapling pkg" + xcrun stapler staple dist/*"$PRODUCT_VERSION"*.pkg +fi + log_success "**********************************" log_success "" log_success " The build finished successfully! " diff --git a/gui/package-lock.json b/gui/package-lock.json index 47d1447d57..dc8686cd42 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -25,7 +25,6 @@ "styled-components": "^6.1.0" }, "devDependencies": { - "@electron/notarize": "^2.1.0", "@playwright/test": "^1.41.1", "@types/chai": "^4.3.3", "@types/chai-as-promised": "^7.1.5", diff --git a/gui/package.json b/gui/package.json index 92093b842d..75892af5ce 100644 --- a/gui/package.json +++ b/gui/package.json @@ -31,7 +31,6 @@ "nseventmonitor": "^1.0.4" }, "devDependencies": { - "@electron/notarize": "^2.1.0", "@playwright/test": "^1.41.1", "@types/chai": "^4.3.3", "@types/chai-as-promised": "^7.1.5", diff --git a/gui/tasks/distribution.js b/gui/tasks/distribution.js index 7087d71301..ada829057b 100644 --- a/gui/tasks/distribution.js +++ b/gui/tasks/distribution.js @@ -2,7 +2,6 @@ const path = require('path'); const fs = require('fs'); const builder = require('electron-builder'); const { Arch } = require('electron-builder'); -const { notarize } = require('@electron/notarize'); const { execFileSync } = require('child_process'); const noCompression = process.argv.includes('--no-compression'); @@ -88,6 +87,7 @@ const config = { artifactName: 'MullvadVPN-${version}.${ext}', category: 'public.app-category.tools', icon: distAssets('icon-macos.icns'), + notarize: shouldNotarize, extendInfo: { LSUIElement: true, NSUserNotificationAlertStyle: 'banner', @@ -315,11 +315,6 @@ function packMac() { return Promise.resolve(); }, afterAllArtifactBuild: async (buildResult) => { - if (shouldNotarize) { - // buildResult.artifactPaths[0] contains the path to the pkg. - await notarizeMac(buildResult.artifactPaths[0]); - } - // Remove the folder that contains the unpacked app. Electron builder cleans up some of // these directories and it's changed between versions without a mention in the changelog. for (const dir of appOutDirs) { @@ -331,26 +326,11 @@ function packMac() { afterSign: (context) => { const appOutDir = context.appOutDir; appOutDirs.push(appOutDir); - - if (shouldNotarize) { - const appName = context.packager.appInfo.productFilename; - return notarizeMac(path.join(appOutDir, `${appName}.app`)); - } }, }, }); } -function notarizeMac(notarizePath) { - console.log('Notarizing ' + notarizePath); - return notarize({ - appBundleId: config.appId, - appPath: notarizePath, - keychain: process.env.NOTARIZE_KEYCHAIN, - keychainProfile: process.env.NOTARIZE_KEYCHAIN_PROFILE, - }); -} - function packLinux() { if (noCompression) { config.rpm.fpm.unshift('--rpm-compression', 'none'); |
