unity-builder/src/model/input.js

33 lines
964 B
JavaScript
Raw Normal View History

import Platform from './platform';
2019-12-22 14:05:15 +00:00
const core = require('@actions/core');
class Input {
2019-12-22 14:05:15 +00:00
static getFromUser() {
// Input variables specified in workflows using "with" prop.
const unityVersion = core.getInput('unityVersion');
const targetPlatform = core.getInput('targetPlatform') || Platform.default;
const rawProjectPath = core.getInput('projectPath') || '.';
const buildName = core.getInput('buildName') || targetPlatform;
const buildsPath = core.getInput('buildsPath') || 'build';
const buildMethod = core.getInput('buildMethod'); // processed in docker file
2020-01-27 18:39:49 +00:00
const customParameters = core.getInput('customParameters') || '';
2019-12-22 14:05:15 +00:00
// Sanitise input
const projectPath = rawProjectPath.replace(/\/$/, '');
// Return sanitised input
2019-12-22 14:05:15 +00:00
return {
unityVersion,
targetPlatform,
2019-12-22 14:05:15 +00:00
projectPath,
buildName,
buildsPath,
buildMethod,
2020-01-27 18:39:49 +00:00
customParameters,
2019-12-22 14:05:15 +00:00
};
}
}
export default Input;