unity-builder/src/model/input.ts

158 lines
3.5 KiB
TypeScript
Raw Normal View History

import Platform from './platform';
2019-12-22 14:05:15 +00:00
const core = require('@actions/core');
/**
* Input variables specified in workflows using "with" prop.
*
* Note that input is always passed as a string, even booleans.
*/
class Input {
2021-12-06 20:56:40 +00:00
public static githubEnabled = true;
public static cliOptions;
private static getInput(query) {
return Input.githubEnabled
? core.getInput(query)
: Input.cliOptions !== undefined
? Input.cliOptions[query]
: process.env[query] !== undefined
? process.env[query]
: false;
}
static get runNumber() {
return Input.getInput('GITHUB_RUN_NUMBER') || '0';
}
static get unityVersion() {
2021-12-06 20:56:40 +00:00
return Input.getInput('unityVersion') || 'auto';
}
static get customImage() {
2021-12-06 20:56:40 +00:00
return Input.getInput('customImage');
}
static get targetPlatform() {
2021-12-06 20:56:40 +00:00
return Input.getInput('targetPlatform') || Platform.default;
}
static get projectPath() {
2021-12-06 20:56:40 +00:00
const rawProjectPath = Input.getInput('projectPath') || '.';
return rawProjectPath.replace(/\/$/, '');
}
static get buildName() {
2021-12-06 20:56:40 +00:00
return Input.getInput('buildName') || this.targetPlatform;
}
static get buildsPath() {
2021-12-06 20:56:40 +00:00
return Input.getInput('buildsPath') || 'build';
}
static get buildMethod() {
2021-12-06 20:56:40 +00:00
return Input.getInput('buildMethod'); // processed in docker file
}
static get versioningStrategy() {
2021-12-06 20:56:40 +00:00
return Input.getInput('versioning') || 'Semantic';
}
static get specifiedVersion() {
2021-12-06 20:56:40 +00:00
return Input.getInput('version') || '';
}
static get androidVersionCode() {
2021-12-06 20:56:40 +00:00
return Input.getInput('androidVersionCode');
}
2020-07-06 01:41:21 +00:00
static get androidAppBundle() {
2021-12-06 20:56:40 +00:00
const input = Input.getInput('androidAppBundle') || false;
2020-07-06 01:41:21 +00:00
2020-08-10 14:30:06 +00:00
return input === 'true';
2020-07-06 01:41:21 +00:00
}
static get androidKeystoreName() {
2021-12-06 20:56:40 +00:00
return Input.getInput('androidKeystoreName') || '';
2020-07-06 01:41:21 +00:00
}
static get androidKeystoreBase64() {
2021-12-06 20:56:40 +00:00
return Input.getInput('androidKeystoreBase64') || '';
2020-07-06 01:41:21 +00:00
}
static get androidKeystorePass() {
2021-12-06 20:56:40 +00:00
return Input.getInput('androidKeystorePass') || '';
2020-07-06 01:41:21 +00:00
}
static get androidKeyaliasName() {
2021-12-06 20:56:40 +00:00
return Input.getInput('androidKeyaliasName') || '';
2020-07-06 01:41:21 +00:00
}
static get androidKeyaliasPass() {
2021-12-06 20:56:40 +00:00
return Input.getInput('androidKeyaliasPass') || '';
2020-07-06 01:41:21 +00:00
}
static get allowDirtyBuild() {
2021-12-06 20:56:40 +00:00
const input = Input.getInput('allowDirtyBuild') || false;
2020-08-10 14:30:06 +00:00
return input === 'true';
}
static get customParameters() {
2021-12-06 20:56:40 +00:00
return Input.getInput('customParameters') || '';
2019-12-22 14:05:15 +00:00
}
static get sshAgent() {
2021-12-06 20:56:40 +00:00
return Input.getInput('sshAgent') || '';
}
static get chownFilesTo() {
2021-12-06 20:56:40 +00:00
return Input.getInput('chownFilesTo') || '';
}
2021-08-15 20:45:22 +00:00
static get postBuildSteps() {
2021-12-13 22:21:26 +00:00
return Input.getInput('postBuildSteps') || '';
2021-08-15 20:45:22 +00:00
}
2021-08-21 23:26:03 +00:00
static get preBuildSteps() {
2021-12-13 22:21:26 +00:00
return Input.getInput('preBuildSteps') || '';
2021-08-21 23:26:03 +00:00
}
static get customBuildSteps() {
2021-12-13 22:21:26 +00:00
return Input.getInput('customBuildSteps') || '';
2021-08-21 23:26:03 +00:00
}
2021-08-17 22:13:46 +00:00
static get cloudRunnerCluster() {
2021-12-06 20:56:40 +00:00
return Input.getInput('cloudRunnerCluster') || '';
}
2021-08-13 19:59:01 +00:00
static get awsBaseStackName() {
2021-12-06 20:56:40 +00:00
return Input.getInput('awsBaseStackName') || '';
}
static get kubeConfig() {
2021-12-06 20:56:40 +00:00
return Input.getInput('kubeConfig') || '';
}
static get githubToken() {
2021-12-06 20:56:40 +00:00
return Input.getInput('githubToken') || '';
}
2021-08-17 22:13:46 +00:00
static get cloudRunnerMemory() {
2021-12-06 20:56:40 +00:00
return Input.getInput('cloudRunnerMemory') || '750M';
}
2021-08-17 22:13:46 +00:00
static get cloudRunnerCpu() {
2021-12-06 20:56:40 +00:00
return Input.getInput('cloudRunnerCpu') || '1.0';
}
static get kubeVolumeSize() {
2021-12-06 20:56:40 +00:00
return Input.getInput('kubeVolumeSize') || '5Gi';
}
static get kubeVolume() {
2021-12-06 20:56:40 +00:00
return Input.getInput('kubeVolume') || '';
}
2019-12-22 14:05:15 +00:00
}
export default Input;