Set build args for container

This commit is contained in:
Webber
2019-12-21 13:56:00 +01:00
committed by Webber Takken
parent dccdec9d3b
commit 454ff6054c
5 changed files with 51 additions and 26 deletions

View File

@@ -10,16 +10,29 @@ async function action() {
// Input variables specified in workflows using "with" prop.
const projectPath = core.getInput('projectPath', { default: './' });
const buildTarget = core.getInput('buildTarget', { default: 'WebGL' });
const targetPlatform = core.getInput('targetPlatform', { default: 'WebGL' });
const unityVersion = core.getInput('unityVersion', { default: '2019.2.11f1' });
const buildName = core.getInput('buildName', { default: 'TestBuild' });
const buildsPath = core.getInput('buildsPath', { default: 'build' });
const buildMethod = core.getInput('buildMethod', { default: '' });
// Determine image
const IMAGE_UNITY_VERSION = unityVersion;
const IMAGE_TARGET_PLATFORM = targetPlatform.toLowerCase();
// Run appropriate docker image with given args
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]);
await exec(bootstrapper, [
IMAGE_UNITY_VERSION,
IMAGE_TARGET_PLATFORM,
projectPath,
targetPlatform,
buildName,
buildsPath,
buildMethod,
]);
}
action().catch(error => {

View File

@@ -4,12 +4,13 @@
# Input variables
#
PROJECT_PATH=$1
UNITY_VERSION="2019.2.11f1"
BUILD_TARGET=$2
BUILD_NAME=$3
BUILDS_PATH=$4
BUILD_METHOD=$5
IMAGE_UNITY_VERSION=$1
IMAGE_TARGET_PLATFORM=$2
PROJECT_PATH=$3
TARGET_PLATFORM=$4
BUILD_NAME=$5
BUILDS_PATH=$6
BUILD_METHOD=$7
#
# Default variables
@@ -42,9 +43,9 @@ BUILD_METHOD=$5
#
ACTION_ROOT=$(dirname $(dirname $(readlink -fm "$0")))
DOCKER_IMAGE_TAG=webber-unity:$UNITY_VERSION-$BUILD_TARGET
DOCKER_IMAGE_TAG=unity-builder:$UNITY_VERSION-$TARGET_PLATFORM
# TODO - Remove debug statements below
# TODO - Remove debug statements (after it is proven to work)
echo "Listing ACTION_ROOT"
ls $ACTION_ROOT
@@ -60,9 +61,12 @@ echo ""
# Build image
#
echo "Building docker images for $BUILD_TARGET"
echo "Building docker image for $UNITY_VERSION-$TARGET_PLATFORM"
docker build $GITHUB_WORKSPACE \
--file $ACTION_ROOT/Dockerfile \
--build-arg IMAGE_REPOSITORY=gableroux \
--build-arg IMAGE_NAME=unity3d \
--build-arg IMAGE_VERSION=$IMAGE_UNITY_VERSION-$IMAGE_TARGET_PLATFORM \
--tag $DOCKER_IMAGE_TAG
#
@@ -73,7 +77,7 @@ docker run \
--workdir /github/workspace \
--rm \
--env PROJECT_PATH \
--env BUILD_TARGET \
--env BUILD_TARGET=$TARGET_PLATFORM \
--env BUILD_NAME \
--env BUILDS_PATH \
--env BUILD_METHOD \