Files
unity-builder/src/model/platform-setup/setup-android.ts
AndrewKahr 5bd589e19f feat: Android updates for Windows and androidVersionCode output (#478)
* Create android keystore on windows, output android version code

* Add androidVersionCode output test

* Move android keystore decode logic to TS
2022-11-23 10:06:58 +01:00

22 lines
902 B
TypeScript

import fs from 'fs';
import path from 'path';
import { BuildParameters } from '..';
class SetupAndroid {
public static async setup(buildParameters: BuildParameters) {
const { targetPlatform, androidKeystoreBase64, androidKeystoreName, projectPath } = buildParameters;
if (targetPlatform === 'Android' && androidKeystoreBase64 !== '' && androidKeystoreName !== '') {
SetupAndroid.setupAndroidRun(androidKeystoreBase64, androidKeystoreName, projectPath);
}
}
private static setupAndroidRun(androidKeystoreBase64: string, androidKeystoreName: string, projectPath: string) {
const decodedKeystore = Buffer.from(androidKeystoreBase64, 'base64').toString('binary');
const githubWorkspace = process.env.GITHUB_WORKSPACE || '';
fs.writeFileSync(path.join(githubWorkspace, projectPath, androidKeystoreName), decodedKeystore, 'binary');
}
}
export default SetupAndroid;