Skip to content

Commit 67cc63a

Browse files
better notary logs
1 parent e7e2935 commit 67cc63a

5 files changed

Lines changed: 65 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ This action requires several secrets that need to be setup in the repository or
6767
| `export-option-plist` | The path to custom export option plist file to use when exporting the Xcode project. | Overrides `export-option`. |
6868
| `entitlements-plist` | The path to custom entitlements plist file. | Generates [default hardened runtime entitlements](https://developer.apple.com/documentation/security/hardened-runtime) if not provided. |
6969
| `notarize` | Whether to notarize the exported Xcode project. | Defaults to `true` if `export-option !== app-store-connect`. |
70+
| `archive-type` | The archive type to use when exporting macOS applications when not uploading to the App Store. Can be one of `app`, `dmg`, or `pkg`. | Defaults to `app`. Forces `app` if `export-option === steam`. |
7071
| `upload` | Whether to upload the exported Xcode project to App Store Connect. | Defaults to `true` if `export-option === app-store-connect`. |
7172
| `whats-new` | When `uploading === true`, Let your testers know what you would like them to test in this build. This information will be available to testers in all groups who have access to this build. | Defaults to the last git commit sha, current branch name, and commit message. |
7273
| `auto-increment-build-number` | Whether to automatically increment the CFBundleVersion in the Xcode project. | Defaults to `true` if `export-option === app-store-connect`. |

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ inputs:
7070
notarize:
7171
description: Whether to notarize the exported Xcode project. Apps to be uploaded to Steam must be notarized by Apple. Defaults to `true` if `export-option === steam`.
7272
required: false
73+
archive-type:
74+
description: The archive type to use when exporting macOS applications when not uploading to the App Store. Can be one of `app`, `dmg`, or `pkg`. Defaults to `app`. Forces `app` if `export-option === steam`.
75+
required: false
76+
default: app
7377
upload:
7478
description: Whether to upload the exported Xcode project to App Store Connect. Defaults to `true` if `export-option === app-store-connect`.
7579
required: false

dist/index.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58593,7 +58593,8 @@ async function notarizeArchive(projectRef, archivePath, staplePath) {
5859358593
core.debug(notarizeOutput);
5859458594
const notaryResult = JSON.parse(notarizeOutput);
5859558595
if (notaryResult.status !== 'Accepted') {
58596-
throw new Error(`Notarization failed! Status: ${notaryResult.status} | ${notaryResult.message}`);
58596+
const notaryLogs = await getNotarizationLog(projectRef, notaryResult.id);
58597+
throw new Error(`Notarization failed! Status: ${notaryResult.status}\n${notaryLogs}`);
5859758598
}
5859858599
const stapleArgs = [
5859958600
'stapler',
@@ -58618,6 +58619,33 @@ async function notarizeArchive(projectRef, archivePath, staplePath) {
5861858619
}
5861958620
core.info(stapleOutput);
5862058621
}
58622+
async function getNotarizationLog(projectRef, id) {
58623+
let output = '';
58624+
const notaryLogArgs = [
58625+
'notarytool',
58626+
'log',
58627+
id,
58628+
'--key', projectRef.credential.appStoreConnectKeyPath,
58629+
'--key-id', projectRef.credential.appStoreConnectKeyId,
58630+
'--issuer', projectRef.credential.appStoreConnectIssuerId,
58631+
'--team-id', projectRef.credential.teamId,
58632+
];
58633+
if (core.isDebug()) {
58634+
notaryLogArgs.push('--verbose');
58635+
}
58636+
const logExitCode = await (0, exec_1.exec)(xcrun, notaryLogArgs, {
58637+
listeners: {
58638+
stdout: (data) => {
58639+
output += data.toString();
58640+
}
58641+
},
58642+
ignoreReturnCode: true
58643+
});
58644+
if (logExitCode !== 0) {
58645+
throw new Error(`Failed to get notarization log!`);
58646+
}
58647+
core.info(output);
58648+
}
5862158649
async function getExportOptions(projectRef) {
5862258650
const exportOptionPlistInput = core.getInput('export-option-plist');
5862358651
let exportOptionsPath = undefined;

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/xcode.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,8 @@ async function notarizeArchive(projectRef: XcodeProject, archivePath: string, st
583583
// {"message":"Processing complete","id":"e0595a17-0db3-42a5-afa9-da2891716ba8","status":"Accepted"}
584584
const notaryResult = JSON.parse(notarizeOutput);
585585
if (notaryResult.status !== 'Accepted') {
586-
throw new Error(`Notarization failed! Status: ${notaryResult.status} | ${notaryResult.message}`);
586+
const notaryLogs = await getNotarizationLog(projectRef, notaryResult.id);
587+
throw new Error(`Notarization failed! Status: ${notaryResult.status}\n${notaryLogs}`);
587588
}
588589
const stapleArgs = [
589590
'stapler',
@@ -609,6 +610,34 @@ async function notarizeArchive(projectRef: XcodeProject, archivePath: string, st
609610
core.info(stapleOutput);
610611
}
611612

613+
async function getNotarizationLog(projectRef: XcodeProject, id: string) {
614+
let output = '';
615+
const notaryLogArgs = [
616+
'notarytool',
617+
'log',
618+
id,
619+
'--key', projectRef.credential.appStoreConnectKeyPath,
620+
'--key-id', projectRef.credential.appStoreConnectKeyId,
621+
'--issuer', projectRef.credential.appStoreConnectIssuerId,
622+
'--team-id', projectRef.credential.teamId,
623+
];
624+
if (core.isDebug()) {
625+
notaryLogArgs.push('--verbose');
626+
}
627+
const logExitCode = await exec(xcrun, notaryLogArgs, {
628+
listeners: {
629+
stdout: (data: Buffer) => {
630+
output += data.toString();
631+
}
632+
},
633+
ignoreReturnCode: true
634+
});
635+
if (logExitCode !== 0) {
636+
throw new Error(`Failed to get notarization log!`);
637+
}
638+
core.info(output);
639+
}
640+
612641
async function getExportOptions(projectRef: XcodeProject): Promise<void> {
613642
const exportOptionPlistInput = core.getInput('export-option-plist');
614643
let exportOptionsPath = undefined;

0 commit comments

Comments
 (0)