From a0cdf43cc5d4e24bf72f03400939a26a3b0e3e7f Mon Sep 17 00:00:00 2001 From: Alex Chaplinsky Date: Thu, 9 Feb 2023 12:17:04 +0100 Subject: [PATCH] Update notarization script --- scripts/notarize.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/notarize.js b/scripts/notarize.js index 1e3136c..31da15f 100644 --- a/scripts/notarize.js +++ b/scripts/notarize.js @@ -1,4 +1,5 @@ require('dotenv').config() +const { spawn } = require('child_process') const { notarize } = require('@electron/notarize') const os = require('os') @@ -9,17 +10,22 @@ exports.default = async function notarizing(context) { return } const dir = os.arch() === 'arm64' ? 'mac-arm64' : 'mac' + const appPath = `packages/${dir}/Swifty.app` try { return await notarize({ + appPath, tool: process.env.NOTARIZE_TOOL, teamId: process.env.APPLETEAMID, appBundleId: 'com.electron.swifty', - appPath: `packages/${dir}/Swifty.app`, appleId: process.env.APPLEID, appleIdPassword: process.env.APPLEIDPASSWORD }) } catch (error) { - console.log(error) + if (error.message.includes('Failed to staple')) { + spawn(`xcrun`, ['stapler', 'staple', appPath]) + } else { + throw error + } } }