-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cb75111
commit 77d1216
Showing
1 changed file
with
32 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,42 @@ | ||
// See: https://medium.com/@TwitterArchiveEraser/notarize-electron-apps-7a5f988406db | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
var electron_notarize = require('electron-notarize'); | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
var electron_notarize = require("electron-notarize"); | ||
|
||
module.exports = async function (params) { | ||
console.log("----------------------------------", params); | ||
var platform = params.packager.platform.name; | ||
// Only notarize the app on Mac OS only. | ||
if (platform === 'linux' || platform === 'windows') { | ||
return; | ||
} | ||
console.log('afterSign hook triggered', params); | ||
console.log("----------------------------------", params); | ||
var platform = params.packager.platform.name; | ||
// Only notarize the app on Mac OS only. | ||
if (platform === "linux" || platform === "windows") { | ||
return; | ||
} | ||
console.log("afterSign hook triggered", params); | ||
|
||
// Same appId in electron-builder. | ||
let appId = 'com.khiops.visualization'; | ||
// Same appId in electron-builder. | ||
let appId = "com.khiops.visualization"; | ||
|
||
let appPath = path.join(params.appOutDir, `${params.packager.appInfo.productFilename}.app`); | ||
if (!fs.existsSync(appPath)) { | ||
throw new Error(`Cannot find application at: ${appPath}`); | ||
} | ||
let appPath = path.join( | ||
params.appOutDir, | ||
`${params.packager.appInfo.productFilename}.app` | ||
); | ||
if (!fs.existsSync(appPath)) { | ||
throw new Error(`Cannot find application at: ${appPath}`); | ||
} | ||
|
||
console.log(`Notarizing ${appId} found at ${appPath}`); | ||
console.log(`Notarizing ${appId} found at ${appPath}`); | ||
|
||
try { | ||
await electron_notarize.notarize({ | ||
appBundleId: appId, | ||
appPath: appPath, | ||
appleApiKey: process.env.API_KEY_ID, | ||
appleApiIssuer: process.env.API_KEY_ISSUER_ID | ||
}); | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
try { | ||
await electron_notarize.notarize({ | ||
tool: "notarytool", | ||
appBundleId: appId, | ||
appPath: appPath, | ||
appleApiKey: process.env.API_KEY_ID, | ||
appleApiIssuer: process.env.API_KEY_ISSUER_ID, | ||
}); | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
|
||
console.log(`Done notarizing ${appId}`); | ||
console.log(`Done notarizing ${appId}`); | ||
}; |