mirror of
https://github.com/scratchfoundation/scratch-desktop.git
synced 2025-08-28 22:19:55 -04:00
notarize non-MAS macOS build (required for 10.15)
This commit is contained in:
parent
6a33d411c1
commit
9c9d7c6979
4 changed files with 67 additions and 0 deletions
42
scripts/afterSign.js
Normal file
42
scripts/afterSign.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
const {notarize} = require('electron-notarize');
|
||||
|
||||
const notarizeMacBuild = async function (context) {
|
||||
// keep this in sync with appId in the electron-builder config
|
||||
const appId = 'edu.mit.scratch.scratch-desktop';
|
||||
|
||||
if (!process.env.AC_USERNAME) {
|
||||
throw new Error(
|
||||
'Notarizing the macOS build requires an Apple ID.\n' +
|
||||
'Please set the environment variable AC_USERNAME.\n' +
|
||||
'Make sure your keychain has an item for "Application Loader: your@apple.id"'
|
||||
);
|
||||
}
|
||||
|
||||
const appleId = process.env.AC_USERNAME;
|
||||
const appleIdKeychainItem = `Application Loader: ${appleId}`;
|
||||
|
||||
console.log(`Notarizing with Apple ID "${appleId}" and keychain item "${appleIdKeychainItem}"`);
|
||||
|
||||
const {appOutDir} = context;
|
||||
const productFilename = context.packager.appInfo.productFilename;
|
||||
await notarize({
|
||||
appBundleId: appId,
|
||||
appPath: `${appOutDir}/${productFilename}.app`,
|
||||
appleId,
|
||||
appleIdPassword: `@keychain:${appleIdKeychainItem}`
|
||||
});
|
||||
};
|
||||
|
||||
const afterSign = async function (context) {
|
||||
const {electronPlatformName} = context;
|
||||
|
||||
switch (electronPlatformName) {
|
||||
case 'mas': // macOS build for Mac App Store
|
||||
break;
|
||||
case 'darwin': // macOS build NOT for Mac App Store
|
||||
await notarizeMacBuild(context);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = afterSign;
|
Loading…
Add table
Add a link
Reference in a new issue