feat: Make key password optional

This commit is contained in:
kceballos committed 2020-02-26 16:32:08 -08:00
1 parent 204ae1749f
commit 8fa256cc0c
4 files changed
+39 -25

No files matched your search

+15 -10
View File
@@ -45,15 +45,18 @@ function signApkFile(apkFile, signingKeyFile, alias, keyStorePassword, keyPasswo
core.debug(`Found 'apksigner' @ ${apkSigner}`);
// apksigner sign --ks my-release-key.jks --out my-app-release.apk my-app-unsigned-aligned.apk
const signedApkFile = apkFile.replace('.apk', '-signed.apk');
yield exec.exec(`"${apkSigner}"`, [
const args = [
'sign',
'--ks', signingKeyFile,
'--ks-key-alias', alias,
'--ks-pass', `pass:${keyStorePassword}`,
'--key-pass', `pass:${keyPassword}`,
'--out', signedApkFile,
alignedApkFile
]);
'--out', signedApkFile
];
if (keyPassword) {
args.push('--key-pass', `pass:${keyPassword}`);
}
args.push(alignedApkFile);
yield exec.exec(`"${apkSigner}"`, args);
// Verify
core.debug("Verifying Signed APK");
yield exec.exec(`"${apkSigner}"`, [
@@ -69,13 +72,15 @@ function signAabFile(aabFile, signingKeyFile, alias, keyStorePassword, keyPasswo
core.debug("Signing AAB file");
const jarSignerPath = yield io.which('jarsigner', true);
core.debug(`Found 'jarsigner' @ ${jarSignerPath}`);
yield exec.exec(`"${jarSignerPath}"`, [
const args = [
'-keystore', signingKeyFile,
'-storepass', keyStorePassword,
'-keypass', keyPassword,
aabFile,
alias
]);
];
if (keyPassword) {
args.push('-keypass', keyPassword);
}
args.push(aabFile, alias);
yield exec.exec(`"${jarSignerPath}"`, args);
return aabFile;
});
}