mirror of
https://github.com/hcengineering/platform.git
synced 2025-03-15 02:23:12 +00:00
QFIX: Add retry to notarize (#7912)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
10bf74ad42
commit
71215a6b76
@ -1,6 +1,28 @@
|
||||
require('dotenv').config();
|
||||
const { notarize } = require('@electron/notarize');
|
||||
|
||||
async function retryNotarize(options, retries = 5, delay = 5000) {
|
||||
for (let i = 0; i < retries; i++) {
|
||||
try {
|
||||
console.log(`Attempt ${i + 1} to notarize...`);
|
||||
await notarize(options);
|
||||
console.log('Notarization successful');
|
||||
return;
|
||||
} catch (error) {
|
||||
console.error(`Notarization attempt ${i + 1} failed:`, error);
|
||||
if (i < retries - 1) {
|
||||
console.log(`Retrying in ${delay / 1000} seconds...`);
|
||||
await new Promise(resolve => setTimeout(resolve, delay));
|
||||
delay *= 2; // Increase delay for the next retry
|
||||
} else {
|
||||
console.log('All notarization attempts failed...');
|
||||
// Add any necessary teardown logic here
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.default = async function notarizing(context) {
|
||||
const { electronPlatformName, appOutDir } = context;
|
||||
if (electronPlatformName !== 'darwin') {
|
||||
@ -9,8 +31,8 @@ exports.default = async function notarizing(context) {
|
||||
|
||||
const appName = context.packager.appInfo.productFilename;
|
||||
|
||||
console.log('Starting custom notarization process...')
|
||||
return await notarize({
|
||||
console.log('Starting custom notarization process...');
|
||||
await retryNotarize({
|
||||
appPath: `${appOutDir}/${appName}.app`,
|
||||
appleId: process.env.APPLE_ID,
|
||||
appleIdPassword: process.env.APPLE_ID_APP_PASS,
|
||||
|
Loading…
Reference in New Issue
Block a user