Skip to content

Commit 50525ef

Browse files
add submit-for-review input option
1 parent 870c9d4 commit 50525ef

File tree

5 files changed

+74
-2
lines changed

5 files changed

+74
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ This action requires several secrets that need to be setup in the repository or
7070
| `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 up to 4000 characters. |
7171
| `auto-increment-build-number` | Whether to automatically increment the `CFBundleVersion` in the Xcode project. | Defaults to `true` if `export-option === app-store-connect`. |
7272
| `test-groups` | One or more test groups to automatically add to the build when uploading to TestFlight. When using multiple groups, separate them with commas. | None by default. |
73+
| `submit-for-review` | Whether to submit the build for review when uploading to App Store Connect. | Defaults to `false`. |
7374
| `developer-id-application-certificate` | The `Developer ID Application` certificate encoded as base64 string. | Required if `export-option === steam` or `export-option === developer-id` or `notarize === true`. |
7475
| `developer-id-application-certificate-password` | The password for the `Developer ID Application` certificate. | Required if `developer-id-application-certificate` is provided. |
7576
| `developer-id-installer-certificate` | The `Developer ID Installer` certificate encoded as base64 string. | Required when creating an installer package for macOS application. |

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ inputs:
9999
test-groups:
100100
description: One or more test groups to automatically add to the build when uploading to TestFlight. When using multiple groups, separate them with commas. None by default.
101101
required: false
102+
submit-for-review:
103+
description: Whether to submit the build for review when uploading to TestFlight. Defaults to `false`.
104+
required: false
102105
developer-id-application-certificate:
103106
description: The `Developer ID Application` certificate encoded as base64 string. Required if `export-option === steam` or `export-option === developer-id` or `notarize === true`.
104107
required: false

dist/index.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57889,6 +57889,38 @@ async function UpdateTestDetails(project, whatsNew) {
5788957889
}
5789057890
const testGroupNames = testGroups.split(',').map(group => group.trim());
5789157891
await AddBuildToTestGroups(project, build, testGroupNames);
57892+
const submitForReview = core.getInput('submit-for-review');
57893+
if (submitForReview) {
57894+
core.info(`Submitting for review...`);
57895+
await submitBetaBuildForReview(project, build);
57896+
}
57897+
}
57898+
async function submitBetaBuildForReview(project, build) {
57899+
await getOrCreateClient(project);
57900+
const payload = {
57901+
body: {
57902+
data: {
57903+
relationships: {
57904+
build: {
57905+
data: {
57906+
id: build.id,
57907+
type: 'builds'
57908+
}
57909+
}
57910+
},
57911+
type: 'betaAppReviewSubmissions',
57912+
}
57913+
}
57914+
};
57915+
(0, utilities_1.log)(`POST /betaAppReviewSubmissions\n${JSON.stringify(payload, null, 2)}`);
57916+
const { data: response, error } = await appStoreConnectClient.api.BetaAppReviewSubmissionsService.betaAppReviewSubmissionsCreateInstance(payload);
57917+
if (error) {
57918+
checkAuthError(error);
57919+
throw new Error(`Error submitting beta build for review: ${JSON.stringify(error, null, 2)}`);
57920+
}
57921+
const responseJson = JSON.stringify(response, null, 2);
57922+
(0, utilities_1.log)(responseJson);
57923+
core.info(`Beta build is ${response.data.attributes.betaReviewState}`);
5789257924
}
5789357925
function normalizeVersion(version) {
5789457926
return version.split('.').map(part => parseInt(part, 10).toString()).join('.');

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/AppStoreConnectClient.ts

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
BetaGroupsGetCollectionData,
1616
BuildsBetaGroupsCreateToManyRelationshipData,
1717
BetaGroup,
18+
BetaAppReviewSubmissionsCreateInstanceData,
1819
} from '@rage-against-the-pixel/app-store-connect-api/dist/app_store_connect_api';
1920
import { log } from './utilities';
2021
import core = require('@actions/core');
@@ -54,7 +55,9 @@ function checkAuthError(error: any) {
5455
export async function GetAppId(project: XcodeProject): Promise<string> {
5556
await getOrCreateClient(project);
5657
const { data: response, error } = await appStoreConnectClient.api.AppsService.appsGetCollection({
57-
query: { 'filter[bundleId]': [project.bundleId] }
58+
query: {
59+
'filter[bundleId]': [project.bundleId]
60+
}
5861
});
5962
if (error) {
6063
checkAuthError(error);
@@ -304,6 +307,39 @@ export async function UpdateTestDetails(project: XcodeProject, whatsNew: string)
304307
if (!testGroups) { return; }
305308
const testGroupNames = testGroups.split(',').map(group => group.trim());
306309
await AddBuildToTestGroups(project, build, testGroupNames);
310+
const submitForReview = core.getInput('submit-for-review');
311+
if (submitForReview) {
312+
core.info(`Submitting for review...`);
313+
await submitBetaBuildForReview(project, build);
314+
}
315+
}
316+
317+
async function submitBetaBuildForReview(project: XcodeProject, build: Build): Promise<void> {
318+
await getOrCreateClient(project);
319+
const payload: BetaAppReviewSubmissionsCreateInstanceData = {
320+
body: {
321+
data: {
322+
relationships: {
323+
build: {
324+
data: {
325+
id: build.id,
326+
type: 'builds'
327+
}
328+
}
329+
},
330+
type: 'betaAppReviewSubmissions',
331+
}
332+
}
333+
};
334+
log(`POST /betaAppReviewSubmissions\n${JSON.stringify(payload, null, 2)}`);
335+
const { data: response, error } = await appStoreConnectClient.api.BetaAppReviewSubmissionsService.betaAppReviewSubmissionsCreateInstance(payload);
336+
if (error) {
337+
checkAuthError(error);
338+
throw new Error(`Error submitting beta build for review: ${JSON.stringify(error, null, 2)}`);
339+
}
340+
const responseJson = JSON.stringify(response, null, 2);
341+
log(responseJson);
342+
core.info(`Beta build is ${response.data.attributes.betaReviewState}`);
307343
}
308344

309345
function normalizeVersion(version: string): string {

0 commit comments

Comments
 (0)