Bootstrap docker from js

This commit is contained in:
Webber
2019-12-17 22:48:54 +01:00
committed by Webber Takken
parent 0bb0dbd7be
commit dccdec9d3b
9 changed files with 184 additions and 91 deletions

View File

@@ -3,44 +3,23 @@ const path = require('path');
const { exec } = require('@actions/exec');
async function action() {
// Path to the project to open with Unity
const projectPath = core.getInput('projectPath', {
required: false,
default: './',
});
// Explicitly notify about platform support
if (process.platform !== 'linux') {
throw new Error('Currently only Linux-based platforms are supported');
}
// Target platform for the build
const buildTarget = core.getInput('buildTarget', {
required: false,
default: 'WebGL',
});
// Name of the build
const buildName = core.getInput('buildName', {
required: false,
default: 'TestBuild',
});
// Path where build will be stored
const buildsPath = core.getInput('buildsPath', {
required: false,
default: 'build',
});
// Method to execute within unity. Must be static
const buildMethod = core.getInput('buildMethod', {
required: false,
default: '',
});
// Input variables specified in workflows using "with" prop.
const projectPath = core.getInput('projectPath', { default: './' });
const buildTarget = core.getInput('buildTarget', { default: 'WebGL' });
const buildName = core.getInput('buildName', { default: 'TestBuild' });
const buildsPath = core.getInput('buildsPath', { default: 'build' });
const buildMethod = core.getInput('buildMethod', { default: '' });
// Run appropriate docker image with given args
await exec(path.join(__dirname, 'run-unity-builder.sh'), [
projectPath,
buildTarget,
buildName,
buildsPath,
buildMethod,
]);
const bootstrapper = path.join(__dirname, 'run-unity-builder.sh');
await exec(`ls ${bootstrapper}`);
await exec(`chmod +x ${bootstrapper}`);
await exec(bootstrapper, [projectPath, buildTarget, buildName, buildsPath, buildMethod]);
}
action().catch(error => {