Skip to content

Commit 2fd2f0a

Browse files
make cert passwords optional
1 parent 6d9501a commit 2fd2f0a

3 files changed

Lines changed: 17 additions & 11 deletions

File tree

dist/index.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57922,14 +57922,14 @@ async function ImportCredentials() {
5792257922
}
5792357923
const developerIdApplicationCertificateBase64 = core.getInput('developer-id-application-certificate');
5792457924
if (developerIdApplicationCertificateBase64) {
57925-
const developerIdApplicationCertificatePassword = core.getInput('developer-id-application-certificate-password', { required: true });
57925+
const developerIdApplicationCertificatePassword = core.getInput('developer-id-application-certificate-password');
5792657926
core.info('Importing developer id application certificate...');
5792757927
await importCertificate(keychainPath, tempCredential, developerIdApplicationCertificateBase64.trim(), developerIdApplicationCertificatePassword.trim());
5792857928
installedCertificates = true;
5792957929
}
5793057930
const developerIdInstallerCertificateBase64 = core.getInput('developer-id-installer-certificate');
5793157931
if (developerIdInstallerCertificateBase64) {
57932-
const developerIdInstallerCertificatePassword = core.getInput('developer-id-installer-certificate-password', { required: true });
57932+
const developerIdInstallerCertificatePassword = core.getInput('developer-id-installer-certificate-password');
5793357933
core.info('Importing developer id installer certificate...');
5793457934
await importCertificate(keychainPath, tempCredential, developerIdInstallerCertificateBase64.trim(), developerIdInstallerCertificatePassword.trim());
5793557935
installedCertificates = true;
@@ -58018,12 +58018,15 @@ async function importCertificate(keychainPath, tempCredential, certificateBase64
5801858018
const certificatePath = `${certificateDirectory}/${tempCredential}-${uuid.v4()}.p12`;
5801958019
const certificate = Buffer.from(certificateBase64, 'base64');
5802058020
await fs.promises.writeFile(certificatePath, certificate);
58021-
await exec.exec(security, [
58021+
const certArgs = [
5802258022
'import', certificatePath,
58023-
'-P', certificatePassword,
5802458023
'-A', '-t', 'cert', '-f', 'pkcs12',
5802558024
'-k', keychainPath
58026-
]);
58025+
];
58026+
if (certificatePassword && certificatePassword.length > 0) {
58027+
certArgs.push('-P', certificatePassword);
58028+
}
58029+
await exec.exec(security, certArgs);
5802758030
const partitionList = 'apple-tool:,apple:,codesign:';
5802858031
if (core.isDebug()) {
5802958032
core.info(`[command]${security} set-key-partition-list -S ${partitionList} -s -k ${tempCredential} ${keychainPath}`);

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export async function ImportCredentials(): Promise<AppleCredential> {
139139
}
140140
const developerIdApplicationCertificateBase64 = core.getInput('developer-id-application-certificate');
141141
if (developerIdApplicationCertificateBase64) {
142-
const developerIdApplicationCertificatePassword = core.getInput('developer-id-application-certificate-password', { required: true });
142+
const developerIdApplicationCertificatePassword = core.getInput('developer-id-application-certificate-password');
143143
core.info('Importing developer id application certificate...');
144144
await importCertificate(
145145
keychainPath,
@@ -150,7 +150,7 @@ export async function ImportCredentials(): Promise<AppleCredential> {
150150
}
151151
const developerIdInstallerCertificateBase64 = core.getInput('developer-id-installer-certificate');
152152
if (developerIdInstallerCertificateBase64) {
153-
const developerIdInstallerCertificatePassword = core.getInput('developer-id-installer-certificate-password', { required: true });
153+
const developerIdInstallerCertificatePassword = core.getInput('developer-id-installer-certificate-password');
154154
core.info('Importing developer id installer certificate...');
155155
await importCertificate(
156156
keychainPath,
@@ -250,12 +250,15 @@ async function importCertificate(keychainPath: string, tempCredential: string, c
250250
const certificatePath = `${certificateDirectory}/${tempCredential}-${uuid.v4()}.p12`;
251251
const certificate = Buffer.from(certificateBase64, 'base64');
252252
await fs.promises.writeFile(certificatePath, certificate);
253-
await exec.exec(security, [
253+
const certArgs = [
254254
'import', certificatePath,
255-
'-P', certificatePassword,
256255
'-A', '-t', 'cert', '-f', 'pkcs12',
257256
'-k', keychainPath
258-
]);
257+
];
258+
if (certificatePassword && certificatePassword.length > 0) {
259+
certArgs.push('-P', certificatePassword);
260+
}
261+
await exec.exec(security, certArgs);
259262
const partitionList = 'apple-tool:,apple:,codesign:'; // : 'apple-tool:,apple:';
260263
if (core.isDebug()) {
261264
core.info(`[command]${security} set-key-partition-list -S ${partitionList} -s -k ${tempCredential} ${keychainPath}`);

0 commit comments

Comments
 (0)