2020-01-20 23:06:14 +00:00
|
|
|
import Platform from './platform';
|
2020-04-26 18:22:09 +00:00
|
|
|
import Versioning from './versioning';
|
2020-01-20 23:06:14 +00:00
|
|
|
|
2019-12-22 14:05:15 +00:00
|
|
|
const core = require('@actions/core');
|
|
|
|
|
|
2020-01-20 23:06:14 +00:00
|
|
|
class Input {
|
2020-04-26 18:22:09 +00:00
|
|
|
static async getFromUser() {
|
2019-12-22 14:05:15 +00:00
|
|
|
// Input variables specified in workflows using "with" prop.
|
2020-04-26 18:22:09 +00:00
|
|
|
const version = core.getInput('unityVersion');
|
2020-01-20 23:06:14 +00:00
|
|
|
const targetPlatform = core.getInput('targetPlatform') || Platform.default;
|
2020-01-27 22:03:29 +00:00
|
|
|
const rawProjectPath = core.getInput('projectPath') || '.';
|
2020-01-20 23:06:14 +00:00
|
|
|
const buildName = core.getInput('buildName') || targetPlatform;
|
|
|
|
|
const buildsPath = core.getInput('buildsPath') || 'build';
|
|
|
|
|
const buildMethod = core.getInput('buildMethod'); // processed in docker file
|
2020-04-26 18:22:09 +00:00
|
|
|
const versioningStrategy = core.getInput('versioning') || 'Semantic';
|
|
|
|
|
const specifiedVersion = core.getInput('version') || '';
|
2020-05-21 12:45:52 +00:00
|
|
|
const rawAllowDirtyBuild = core.getInput('allowDirtyBuild') || 'false';
|
2020-01-27 18:39:49 +00:00
|
|
|
const customParameters = core.getInput('customParameters') || '';
|
2019-12-22 14:05:15 +00:00
|
|
|
|
2020-01-27 22:03:29 +00:00
|
|
|
// Sanitise input
|
|
|
|
|
const projectPath = rawProjectPath.replace(/\/$/, '');
|
2020-05-21 12:45:52 +00:00
|
|
|
const allowDirtyBuild = rawAllowDirtyBuild === 'true' ? 'true' : 'false';
|
2020-01-27 22:03:29 +00:00
|
|
|
|
2020-04-26 18:22:09 +00:00
|
|
|
// Parse input
|
|
|
|
|
const buildVersion = await Versioning.determineVersion(versioningStrategy, specifiedVersion);
|
2020-04-22 20:12:04 +00:00
|
|
|
|
2020-04-26 18:22:09 +00:00
|
|
|
// Return validated input
|
2019-12-22 14:05:15 +00:00
|
|
|
return {
|
2020-04-26 18:22:09 +00:00
|
|
|
version,
|
2020-01-20 23:06:14 +00:00
|
|
|
targetPlatform,
|
2019-12-22 14:05:15 +00:00
|
|
|
projectPath,
|
|
|
|
|
buildName,
|
|
|
|
|
buildsPath,
|
2020-01-20 23:06:14 +00:00
|
|
|
buildMethod,
|
2020-04-26 18:22:09 +00:00
|
|
|
buildVersion,
|
2020-05-21 12:45:52 +00:00
|
|
|
allowDirtyBuild,
|
2020-01-27 18:39:49 +00:00
|
|
|
customParameters,
|
2019-12-22 14:05:15 +00:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-01-20 23:06:14 +00:00
|
|
|
|
|
|
|
|
export default Input;
|