2019-12-22 14:05:15 +00:00
|
|
|
import Action from './model/action';
|
|
|
|
|
import Docker from './model/docker';
|
|
|
|
|
import ImageTag from './model/image';
|
|
|
|
|
import Input from './model/input';
|
|
|
|
|
|
2019-12-16 23:53:39 +00:00
|
|
|
const core = require('@actions/core');
|
|
|
|
|
|
|
|
|
|
async function action() {
|
2019-12-22 14:05:15 +00:00
|
|
|
Action.checkCompatibility();
|
2019-12-21 12:56:00 +00:00
|
|
|
|
2019-12-22 14:05:15 +00:00
|
|
|
const {
|
|
|
|
|
unityVersion,
|
2019-12-21 12:56:00 +00:00
|
|
|
targetPlatform,
|
2019-12-22 14:05:15 +00:00
|
|
|
projectPath,
|
2019-12-21 12:56:00 +00:00
|
|
|
buildName,
|
|
|
|
|
buildsPath,
|
|
|
|
|
buildMethod,
|
2019-12-22 14:05:15 +00:00
|
|
|
} = Input.getFromUser();
|
|
|
|
|
|
|
|
|
|
const { dockerfile, workspace } = Action;
|
|
|
|
|
const baseImage = new ImageTag({ unityVersion, targetPlatform });
|
|
|
|
|
const builtImage = await Docker.build({ path: workspace, dockerfile, image: baseImage });
|
|
|
|
|
await Docker.run(builtImage, { projectPath, buildName, buildsPath, buildMethod });
|
2019-12-16 23:53:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
action().catch(error => {
|
|
|
|
|
core.setFailed(error.message);
|
|
|
|
|
});
|