mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-06-01 06:16:14 -07:00
* Create android keystore on windows, output android version code * Add androidVersionCode output test * Move android keystore decode logic to TS
22 lines
902 B
TypeScript
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;
|