mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-04 12:25:19 -04:00
Add initial script
This commit is contained in:
parent
25294aec32
commit
302bd4c880
48
src/index.js
Normal file
48
src/index.js
Normal file
@ -0,0 +1,48 @@
|
||||
const core = require('@actions/core');
|
||||
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: './',
|
||||
});
|
||||
|
||||
// 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: '',
|
||||
});
|
||||
|
||||
// Run appropriate docker image with given args
|
||||
await exec(path.join(__dirname, 'run-unity-builder.sh'), [
|
||||
projectPath,
|
||||
buildTarget,
|
||||
buildName,
|
||||
buildsPath,
|
||||
buildMethod,
|
||||
]);
|
||||
}
|
||||
|
||||
action().catch(error => {
|
||||
core.setFailed(error.message);
|
||||
});
|
46
src/run-unity-builder.sh
Normal file
46
src/run-unity-builder.sh
Normal file
@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
PROJECT_PATH=$1
|
||||
BUILD_TARGET=$2
|
||||
BUILD_NAME=$3
|
||||
BUILDS_PATH=$4
|
||||
BUILD_METHOD=$5
|
||||
|
||||
DOCKER_IMAGE_TAG=unity-builder-image
|
||||
|
||||
echo "Running docker container with specific tag"
|
||||
|
||||
docker build \
|
||||
--file ../Dockerfile \
|
||||
--tag DOCKER_IMAGE_TAG \
|
||||
../
|
||||
|
||||
docker run \
|
||||
--workdir /github/workspace \
|
||||
--rm \
|
||||
--env PROJECT_PATH \
|
||||
--env BUILD_TARGET \
|
||||
--env BUILD_NAME \
|
||||
--env BUILDS_PATH \
|
||||
--env BUILD_METHOD \
|
||||
--env HOME \
|
||||
--env GITHUB_REF \
|
||||
--env GITHUB_SHA \
|
||||
--env GITHUB_REPOSITORY \
|
||||
--env GITHUB_ACTOR \
|
||||
--env GITHUB_WORKFLOW \
|
||||
--env GITHUB_HEAD_REF \
|
||||
--env GITHUB_BASE_REF \
|
||||
--env GITHUB_EVENT_NAME \
|
||||
--env GITHUB_WORKSPACE \
|
||||
--env GITHUB_ACTION \
|
||||
--env GITHUB_EVENT_PATH \
|
||||
--env RUNNER_OS \
|
||||
--env RUNNER_TOOL_CACHE \
|
||||
--env RUNNER_TEMP \
|
||||
--env RUNNER_WORKSPACE \
|
||||
--volume "/var/run/docker.sock":"/var/run/docker.sock" \
|
||||
--volume "/home/runner/work/_temp/_github_home":"/github/home" \
|
||||
--volume "/home/runner/work/_temp/_github_workflow":"/github/workflow" \
|
||||
--volume "${PWD}":"/github/workspace" \
|
||||
DOCKER_IMAGE_TAG
|
Loading…
Reference in New Issue
Block a user