Chore: trying to fix notarization

pull/4192/head
Laurent Cozic 2020-12-05 11:06:20 +00:00
parent 8d90cc234f
commit 245976f659
1 changed files with 24 additions and 0 deletions

View File

@ -2,6 +2,24 @@ const fs = require('fs');
const path = require('path');
const electron_notarize = require('electron-notarize');
function execCommand(command) {
const exec = require('child_process').exec;
return new Promise((resolve, reject) => {
exec(command, (error, stdout, stderr) => {
if (error) {
if (error.signal == 'SIGTERM') {
resolve('Process was killed');
} else {
reject(new Error([stdout.trim(), stderr.trim()].join('\n')));
}
} else {
resolve([stdout.trim(), stderr.trim()].join('\n'));
}
});
});
}
module.exports = async function(params) {
if (process.platform !== 'darwin') return;
@ -48,5 +66,11 @@ module.exports = async function(params) {
ascProvider: process.env.APPLE_ASC_PROVIDER,
});
console.log('Staple notarization ticket to the app...');
const staplerCmd = `xcrun stapler staple "${appPath}"`;
console.log(`> ${staplerCmd}`);
console.log(await execCommand(staplerCmd));
console.log(`Done notarizing ${appId}`);
};