2019-12-16 23:53:39 +00:00
|
|
|
const core = require('@actions/core');
|
|
|
|
|
const path = require('path');
|
|
|
|
|
const { exec } = require('@actions/exec');
|
|
|
|
|
|
|
|
|
|
async function action() {
|
2019-12-17 21:48:54 +00:00
|
|
|
// Explicitly notify about platform support
|
|
|
|
|
if (process.platform !== 'linux') {
|
|
|
|
|
throw new Error('Currently only Linux-based platforms are supported');
|
|
|
|
|
}
|
2019-12-16 23:53:39 +00:00
|
|
|
|
2019-12-17 21:48:54 +00:00
|
|
|
// Input variables specified in workflows using "with" prop.
|
|
|
|
|
const projectPath = core.getInput('projectPath', { default: './' });
|
2019-12-21 12:56:00 +00:00
|
|
|
const targetPlatform = core.getInput('targetPlatform', { default: 'WebGL' });
|
|
|
|
|
const unityVersion = core.getInput('unityVersion', { default: '2019.2.11f1' });
|
2019-12-17 21:48:54 +00:00
|
|
|
const buildName = core.getInput('buildName', { default: 'TestBuild' });
|
|
|
|
|
const buildsPath = core.getInput('buildsPath', { default: 'build' });
|
|
|
|
|
const buildMethod = core.getInput('buildMethod', { default: '' });
|
2019-12-16 23:53:39 +00:00
|
|
|
|
2019-12-21 12:56:00 +00:00
|
|
|
// Determine image
|
|
|
|
|
const IMAGE_UNITY_VERSION = unityVersion;
|
|
|
|
|
const IMAGE_TARGET_PLATFORM = targetPlatform.toLowerCase();
|
|
|
|
|
|
2019-12-16 23:53:39 +00:00
|
|
|
// Run appropriate docker image with given args
|
2019-12-17 21:48:54 +00:00
|
|
|
const bootstrapper = path.join(__dirname, 'run-unity-builder.sh');
|
|
|
|
|
await exec(`ls ${bootstrapper}`);
|
|
|
|
|
await exec(`chmod +x ${bootstrapper}`);
|
2019-12-21 12:56:00 +00:00
|
|
|
await exec(bootstrapper, [
|
|
|
|
|
IMAGE_UNITY_VERSION,
|
|
|
|
|
IMAGE_TARGET_PLATFORM,
|
|
|
|
|
projectPath,
|
|
|
|
|
targetPlatform,
|
|
|
|
|
buildName,
|
|
|
|
|
buildsPath,
|
|
|
|
|
buildMethod,
|
|
|
|
|
]);
|
2019-12-16 23:53:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
action().catch(error => {
|
|
|
|
|
core.setFailed(error.message);
|
|
|
|
|
});
|