Bootstrap docker from js
This commit is contained in:
49
src/index.js
49
src/index.js
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user