Allow versioning and version parameters.

This commit is contained in:
Webber
2020-04-22 22:12:04 +02:00
committed by Webber Takken
parent e8a2eaad72
commit 39a160b789
8 changed files with 38 additions and 6 deletions

View File

@@ -1,7 +1,10 @@
import Platform from './platform';
import ValidationError from './error/validation-error';
const core = require('@actions/core');
const versioningStrategies = ['None', 'Semantic', 'Tag', 'Custom'];
class Input {
static getFromUser() {
// Input variables specified in workflows using "with" prop.
@@ -11,11 +14,20 @@ class Input {
const buildName = core.getInput('buildName') || targetPlatform;
const buildsPath = core.getInput('buildsPath') || 'build';
const buildMethod = core.getInput('buildMethod'); // processed in docker file
const versioning = core.getInput('versioning') || 'Semantic';
const version = core.getInput('version') || '';
const customParameters = core.getInput('customParameters') || '';
// Sanitise input
const projectPath = rawProjectPath.replace(/\/$/, '');
// Validate input
if (!versioningStrategies.includes(versioning)) {
throw new ValidationError(
`Versioning strategy should be one of ${versioningStrategies.join(', ')}.`,
);
}
// Return sanitised input
return {
unityVersion,
@@ -24,6 +36,8 @@ class Input {
buildName,
buildsPath,
buildMethod,
versioning,
version,
customParameters,
};
}