You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.8 KiB
54 lines
1.8 KiB
9 months ago
|
|
||
|
const { notarize } = require('@electron/notarize');
|
||
9 months ago
|
const fs = require('fs');
|
||
9 months ago
|
const { exec } = require('child_process'); // Import the exec function
|
||
9 months ago
|
exports.default = async function notarizing(context) {
|
||
|
const { electronPlatformName, appOutDir } = context; // Provided by electron-builder
|
||
|
|
||
|
console.log('NOTARIZING');
|
||
|
|
||
9 months ago
|
if (electronPlatformName !== 'darwin' || !process.env.CIRCLE_BRANCH) {
|
||
9 months ago
|
return;
|
||
|
}
|
||
|
|
||
|
const appName = context.packager.appInfo.productFilename;
|
||
|
|
||
9 months ago
|
const files = fs.readdirSync(appOutDir, 'utf8')
|
||
|
|
||
|
|
||
|
console.log(files);
|
||
9 months ago
|
|
||
9 months ago
|
console.log({
|
||
|
appBundleId: 'org.ethereum.remix-ide', // Your app's bundle ID
|
||
|
appPath: `${appOutDir}/${appName}.app`, // Path to your .app
|
||
|
appleId: process.env.APPLE_ID, // Your Apple ID
|
||
|
appleIdPassword: process.env.APPLE_ID_PASSWORD, // App-specific password
|
||
|
teamId: process.env.APPLE_TEAM_ID, // Your Apple Developer team ID (optional)
|
||
|
})
|
||
|
|
||
9 months ago
|
try {
|
||
|
const r = await notarize({
|
||
|
appBundleId: 'org.ethereum.remix-ide', // Your app's bundle ID
|
||
|
appPath: `${appOutDir}/${appName}.app`, // Path to your .app
|
||
|
appleId: process.env.APPLE_ID, // Your Apple ID
|
||
|
appleIdPassword: process.env.APPLE_ID_PASSWORD, // App-specific password
|
||
|
teamId: process.env.APPLE_TEAM_ID, // Your Apple Developer team ID (optional)
|
||
|
});
|
||
|
|
||
|
console.log(r);
|
||
|
|
||
|
// Stapling the app
|
||
|
console.log('STAPLING');
|
||
|
const appPath = `${appOutDir}/${appName}.app`;
|
||
|
exec(`xcrun stapler staple "${appPath}"`, (error, stdout, stderr) => {
|
||
|
if (error) {
|
||
|
console.error(`exec error: ${error}`);
|
||
|
return;
|
||
|
}
|
||
|
console.log(`Stapling output: ${stdout}`);
|
||
|
console.error(`Stapling errors: ${stderr}`);
|
||
|
});
|
||
|
} catch (error) {
|
||
|
console.error('Error during notarization:', error);
|
||
|
}
|
||
9 months ago
|
};
|