2020-01-29 21:22:26 +00:00
|
|
|
import * as core from '@actions/core';
|
|
|
|
import { Action, Docker, Input, ImageTag, Output } from './model';
|
|
|
|
|
|
|
|
async function action() {
|
|
|
|
Action.checkCompatibility();
|
|
|
|
|
|
|
|
const { dockerfile, workspace, actionFolder } = Action;
|
2020-01-30 23:57:08 +00:00
|
|
|
const {
|
|
|
|
unityVersion,
|
|
|
|
projectPath,
|
|
|
|
testMode,
|
|
|
|
artifactsPath,
|
|
|
|
customParameters,
|
|
|
|
} = Input.getFromUser();
|
2020-01-29 21:22:26 +00:00
|
|
|
const baseImage = ImageTag.createForBase(unityVersion);
|
|
|
|
|
|
|
|
// Build docker image
|
|
|
|
const actionImage = await Docker.build({ path: actionFolder, dockerfile, baseImage });
|
|
|
|
|
|
|
|
// Run docker image
|
2020-01-29 22:54:44 +00:00
|
|
|
await Docker.run(actionImage, {
|
|
|
|
workspace,
|
|
|
|
unityVersion,
|
|
|
|
projectPath,
|
2020-01-30 23:57:08 +00:00
|
|
|
testMode,
|
2020-01-29 22:54:44 +00:00
|
|
|
artifactsPath,
|
|
|
|
customParameters,
|
|
|
|
});
|
2020-01-29 21:22:26 +00:00
|
|
|
|
|
|
|
// Set output
|
|
|
|
await Output.setArtifactsPath(artifactsPath);
|
|
|
|
}
|
|
|
|
|
|
|
|
action().catch(error => {
|
|
|
|
core.setFailed(error.message);
|
|
|
|
});
|