Updates the notarisation process

This commit is contained in:
Dmitry Vedenko 2024-02-29 20:50:18 +03:00
parent 924119fc8c
commit 01503fed15
No known key found for this signature in database
GPG Key ID: F4C37A6204F983A2
3 changed files with 28 additions and 41 deletions

File diff suppressed because one or more lines are too long

View File

@ -104,56 +104,42 @@ async function signDMG(dmgPath, appIdentifier, codesignIdentifier) {
]);
}
async function notarizeDMG(dmgPath, appIdentifier, notarizationUser, notarizationPassword) {
if (!notarizationUser || !notarizationUser) {
helpers.log("Skipping notarization, as there are np credentials provided");
async function notarizeDMG(dmgPath, notarizationUser, notarizationPassword, notarizationTeamId) {
if (!notarizationUser || !notarizationUser || !notarizationTeamId) {
helpers.log("Skipping notarization, as there are no credentials provided");
return ;
}
helpers.log(`Notarizing DMG: ${dmgPath}`)
const notarizationResult = await helpers.getExecOutput('xcrun', [
'altool', '--notarize-app',
'--primary-bundle-id', appIdentifier,
'--file', dmgPath,
'--username', notarizationUser,
'notarytool', 'submit',
'--apple-id', notarizationUser,
'--team-id', notarizationTeamId,
'--password', notarizationPassword,
'--output-format', 'xml'
'--output-format', 'json',
'--wait', dmgPath
]);
const requestId = plist.parse(notarizationResult.stdout)['notarization-upload']['RequestUUID'];
const parsedResult = JSON.parse(notarizationResult.stdout);
for(;;) {
await helpers.sleep(30000);
const notarizationLog = await helpers.getExecOutput('xcrun', [
'notarytool', 'log',
'--apple-id', notarizationUser,
'--team-id', notarizationTeamId,
'--password', notarizationPassword,
parsedResult["id"]
]);
const notarizationInfo = await helpers.getExecOutput('xcrun', [
'altool',
'--notarization-info', requestId,
'--username', notarizationUser,
'--password', notarizationPassword,
'--output-format', 'xml'
]);
helpers.log(notarizationLog.stdout);
const parsedInfo = plist.parse(notarizationInfo.stdout);
const status = parsedInfo['notarization-info']['Status'];
if(status == 'success') {
return
} else if (status != 'in progress') {
const logUrl = parsedInfo['notarization-info']['LogFileURL'];
if (logUrl) {
const logResponse = await fetch(logUrl);
if (logResponse.ok) {
const log = await logResponse.text();
throw Error(`Notarization failed:\n${log}`);
}
}
throw Error(notarizationInfo.stdout);
}
if (parsedResult["status"] != "Accepted") {
throw Error(`Notarization failed: ${parsedResult["status"]}`);
}
await helpers.execWithLog('xcrun', ["stapler", "staple", dmgPath]);
helpers.log(`Notarizing was successful: ${dmgPath}`)
}
module.exports = {

View File

@ -30,6 +30,7 @@ if (universalArchitectures.length == 0) {
const codesignIdentifier = core.getInput('apple_codesign_identity');
const userName = core.getInput('apple_notarization_user_name');
const password = core.getInput('apple_notarization_password');
const teamId = core.getInput('apple_notarization_team_id');
async function packageAudacity(target) {
const buildArgs = [
@ -107,7 +108,7 @@ async function packageApp(app, suffix, packageDir) {
await appleCodeSigning.signDMG(dmgPath, bundleIdentifier, codesignIdentifier);
if (userName !== '' && password !== '' && buildLevel != BuildLevel.Alpha) {
await appleCodeSigning.notarizeDMG(dmgPath, bundleIdentifier, userName, password);
await appleCodeSigning.notarizeDMG(dmgPath, userName, password, teamId);
}
}
}