From c8b1b80829d26caccbcac551356e791390bc1a4e Mon Sep 17 00:00:00 2001 From: Webber Date: Sat, 7 Dec 2019 23:52:05 +0100 Subject: [PATCH] Include default-build-script in docker --- .dockerignore | 1 + Dockerfile | 1 + entrypoint.sh | 25 ++++++++++++++++++------- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.dockerignore b/.dockerignore index 1b9c1a61..d72f91f9 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,3 +4,4 @@ # Files required for the action !entrypoint.sh !action.yml +!default-build-script diff --git a/Dockerfile b/Dockerfile index 723ae064..03aef9a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,7 @@ LABEL "repository"="http://github.com/webbertakken/unity-actions" LABEL "homepage"="http://github.com/webbertakken/unity-actions" LABEL "maintainer"="Webber Takken " +ADD default-build-script /UnityBuilderAction ADD entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh index bf9864f3..3656ca8a 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -47,21 +47,32 @@ CURRENT_BUILD_PATH=$BUILDS_PATH/$BUILD_TARGET CURRENT_BUILD_FULL_PATH=$BUILDS_FULL_PATH/$BUILD_TARGET # -# Set the build command, must reference one of: +# Set the build method, must reference one of: # # - # - # # For example: `BuildCommand.PerformBuild` # -# The method must be defined static +# The method must be declared static and placed in project/Assets/Editor # -if [ -z "$BUILD_COMMAND" ]; then - # TODO - copy Builder class from root - EXECUTE_METHOD="-executeMethod Builder.BuildProject" +if [ -n "$BUILD_METHOD" ]; then + # User has provided their own build method. + # + # Assume they also bring their own script; simply reference it. + # + EXECUTE_BUILD_METHOD="-executeMethod $BUILD_METHOD" + # else - EXECUTE_METHOD="-executeMethod $BUILD_COMMAND" + # User has not provided their own build command. + # + # Use the script from this action which builds the scenes that are enabled in + # the project. + # + cp -r /UnityBuilderAction $CURRENT_BUILD_PATH/Assets/Editor/ + EXECUTE_BUILD_METHOD="-executeMethod UnityBuilderAction.Builder.BuildProject" + # fi @@ -116,7 +127,7 @@ xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \ -buildTarget "$BUILD_TARGET" \ -customBuildTarget "$BUILD_TARGET" \ -customBuildPath "$CURRENT_BUILD_FULL_PATH" \ - $EXECUTE_METHOD + $EXECUTE_BUILD_METHOD # Catch exit code BUILD_EXIT_CODE=$?