Skip to content

Commit e9e37af

Browse files
fix test groups
1 parent 4d5cb80 commit e9e37af

4 files changed

Lines changed: 45 additions & 23 deletions

File tree

dist/index.js

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57746,12 +57746,13 @@ async function UpdateTestDetails(project, whatsNew) {
5774657746
core.info(`Updating beta build localization...`);
5774757747
await updateBetaBuildLocalization(betaBuildLocalization, whatsNew);
5774857748
}
57749-
const betaGroups = core.getInput('beta-groups');
57750-
if (!betaGroups) {
57749+
const testGroups = core.getInput('test-groups');
57750+
core.info(`Beta groups: ${testGroups}`);
57751+
if (!testGroups) {
5775157752
return;
5775257753
}
57753-
const betaGroupNames = betaGroups.split(',').map(group => group.trim());
57754-
await AddBuildToTestGroups(project, build, betaGroupNames);
57754+
const testGroupNames = testGroups.split(',').map(group => group.trim());
57755+
await AddBuildToTestGroups(project, build, testGroupNames);
5775557756
}
5775657757
function normalizeVersion(version) {
5775757758
return version.split('.').map(part => parseInt(part, 10).toString()).join('.');
@@ -57995,21 +57996,32 @@ async function RemoveCredentials() {
5799557996
}
5799657997
async function CreateSigningCertificate(project, certificateType) {
5799757998
const certId = `${uuid.v4()}`;
57998-
const csrContent = await createCSR(certId);
57999+
const csrContent = await createCSR(certId, certificateType);
5799958000
const certificate = await (0, AppStoreConnectClient_1.CreateNewCertificate)(project, certificateType, csrContent);
5800058001
const certificateDirectory = await getCertificateDirectory();
5800158002
const certificateName = `${certificateType}-${certId}.cer`;
5800258003
const certificatePath = `${certificateDirectory}/${certificateName}`;
5800358004
core.debug(`Certificate path: ${certificatePath}`);
5800458005
}
58005-
async function createCSR(certId) {
58006+
async function createCSR(certId, certificateType) {
58007+
const tempCredential = core.getState('tempCredential');
5800658008
const certificateDirectory = await getCertificateDirectory();
5800758009
const privateKeyPath = path.join(certificateDirectory, `signing-${certId}.key`);
5800858010
const csrPath = path.join(certificateDirectory, `signing-${certId}.csr`);
58009-
await exec.exec('openssl', ['genrsa', '-out', privateKeyPath, '2048']);
5801058011
await exec.exec('openssl', [
58011-
'req', '-new', '-key', privateKeyPath, '-out', csrPath,
58012-
'-subj', '/CN=Apple Distribution',
58012+
'genpkey',
58013+
'-algorithm', 'RSA',
58014+
'-aes256',
58015+
'-pass', `pass:${tempCredential}`,
58016+
'-out', privateKeyPath,
58017+
'-pkeyopt', 'rsa_keygen_bits:2048'
58018+
]);
58019+
await exec.exec('openssl', [
58020+
'req', '-new',
58021+
'-key', privateKeyPath,
58022+
'-out', csrPath,
58023+
'-subj', `/CN=${certificateType}/O=App Store Connect API`,
58024+
'-passin', `pass:${tempCredential}`
5801358025
]);
5801458026
return await fs.promises.readFile(csrPath, 'utf8');
5801558027
}

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: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,11 @@ export async function UpdateTestDetails(project: XcodeProject, whatsNew: string)
303303
core.info(`Updating beta build localization...`);
304304
await updateBetaBuildLocalization(betaBuildLocalization, whatsNew);
305305
}
306-
const betaGroups = core.getInput('beta-groups');
307-
if (!betaGroups) { return; }
308-
const betaGroupNames = betaGroups.split(',').map(group => group.trim());
309-
await AddBuildToTestGroups(project, build, betaGroupNames);
306+
const testGroups = core.getInput('test-groups');
307+
core.info(`Beta groups: ${testGroups}`);
308+
if (!testGroups) { return; }
309+
const testGroupNames = testGroups.split(',').map(group => group.trim());
310+
await AddBuildToTestGroups(project, build, testGroupNames);
310311
}
311312

312313
function normalizeVersion(version: string): string {

src/AppleCredential.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -196,28 +196,37 @@ export async function RemoveCredentials(): Promise<void> {
196196

197197
export async function CreateSigningCertificate(project: XcodeProject, certificateType: CertificateType) {
198198
const certId = `${uuid.v4()}`;
199-
const csrContent = await createCSR(certId);
199+
const csrContent = await createCSR(certId, certificateType);
200200
const certificate = await CreateNewCertificate(project, certificateType, csrContent);
201201
const certificateDirectory = await getCertificateDirectory();
202202
const certificateName = `${certificateType}-${certId}.cer`;
203203
const certificatePath = `${certificateDirectory}/${certificateName}`;
204204
core.debug(`Certificate path: ${certificatePath}`);
205205
}
206206

207-
async function createCSR(certId: string): Promise<string> {
207+
async function createCSR(certId: string, certificateType: CertificateType): Promise<string> {
208+
const tempCredential = core.getState('tempCredential');
208209
const certificateDirectory = await getCertificateDirectory();
209210
const privateKeyPath = path.join(certificateDirectory, `signing-${certId}.key`);
210211
const csrPath = path.join(certificateDirectory, `signing-${certId}.csr`);
211212

212-
// Generate a new RSA private key (unencrypted)
213-
await exec.exec('openssl', ['genrsa', '-out', privateKeyPath, '2048']);
214-
215-
// Generate a CSR using the private key
213+
// Generate a new RSA private key (encrypted with tempCredential as passphrase)
216214
await exec.exec('openssl', [
217-
'req', '-new', '-key', privateKeyPath, '-out', csrPath,
218-
'-subj', '/CN=Apple Distribution',
219-
// give the CSR a unique name based on the certId
215+
'genpkey',
216+
'-algorithm', 'RSA',
217+
'-aes256',
218+
'-pass', `pass:${tempCredential}`,
219+
'-out', privateKeyPath,
220+
'-pkeyopt', 'rsa_keygen_bits:2048'
221+
]);
220222

223+
// Generate a CSR using the encrypted private key and tempCredential as passphrase
224+
await exec.exec('openssl', [
225+
'req', '-new',
226+
'-key', privateKeyPath,
227+
'-out', csrPath,
228+
'-subj', `/CN=${certificateType}/O=App Store Connect API`,
229+
'-passin', `pass:${tempCredential}`
221230
]);
222231

223232
return await fs.promises.readFile(csrPath, 'utf8');

0 commit comments

Comments
 (0)