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
This commit is contained in:
@@ -7,3 +7,11 @@ describe('Output', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Output', () => {
|
||||
describe('setAndroidVersionCode', () => {
|
||||
it('does not throw', async () => {
|
||||
await expect(Output.setAndroidVersionCode('1000')).resolves.not.toThrow();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,6 +4,10 @@ class Output {
|
||||
static async setBuildVersion(buildVersion) {
|
||||
await core.setOutput('buildVersion', buildVersion);
|
||||
}
|
||||
|
||||
static async setAndroidVersionCode(androidVersionCode) {
|
||||
await core.setOutput('androidVersionCode', androidVersionCode);
|
||||
}
|
||||
}
|
||||
|
||||
export default Output;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import fs from 'fs';
|
||||
import * as core from '@actions/core';
|
||||
import { BuildParameters } from '.';
|
||||
import { SetupMac, SetupWindows } from './platform-setup/';
|
||||
import { SetupMac, SetupWindows, SetupAndroid } from './platform-setup/';
|
||||
import ValidateWindows from './platform-validation/validate-windows';
|
||||
|
||||
class PlatformSetup {
|
||||
@@ -33,6 +33,8 @@ class PlatformSetup {
|
||||
let servicesConfig = fs.readFileSync(servicesConfigPathTemplate).toString();
|
||||
servicesConfig = servicesConfig.replace('%URL%', buildParameters.unityLicensingServer);
|
||||
fs.writeFileSync(servicesConfigPath, servicesConfig);
|
||||
|
||||
SetupAndroid.setup(buildParameters);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import SetupWindows from './setup-windows';
|
||||
import SetupMac from './setup-mac';
|
||||
import SetupAndroid from './setup-android';
|
||||
|
||||
export { SetupWindows, SetupMac };
|
||||
export { SetupWindows, SetupMac, SetupAndroid };
|
||||
|
||||
21
src/model/platform-setup/setup-android.ts
Normal file
21
src/model/platform-setup/setup-android.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user