From 1a40a9a050aecd5f22698da8cd60e8aeb946bf9f Mon Sep 17 00:00:00 2001 From: Scion Date: Sun, 19 Mar 2023 02:35:02 -0700 Subject: [PATCH] Updated with UnityBuilder and cache. --- unity-command/Dockerfile | 6 +++--- unity-command/action.yaml | 4 ++++ unity-command/entrypoint.sh | 8 ++++++-- unity-command/install-dotnet.sh | 13 ------------- unity-project/action.yaml | 19 ++++++++++++++----- 5 files changed, 27 insertions(+), 23 deletions(-) delete mode 100644 unity-command/install-dotnet.sh diff --git a/unity-command/Dockerfile b/unity-command/Dockerfile index 9cc25be..03011df 100644 --- a/unity-command/Dockerfile +++ b/unity-command/Dockerfile @@ -2,12 +2,12 @@ ARG IMAGE=unityci/base:latest FROM ${IMAGE} +RUN apt update +RUN apt install -y wget chromium-browser + COPY entrypoint.sh / RUN chmod +x /entrypoint.sh -COPY install-dotnet.sh / -RUN bash /install-dotnet.sh - ADD https://minio.studiowhy.net/hackmd/UnityBuilder /usr/local/bin/ RUN chmod +x /usr/local/bin/UnityBuilder diff --git a/unity-command/action.yaml b/unity-command/action.yaml index f7624f6..dce0b9d 100644 --- a/unity-command/action.yaml +++ b/unity-command/action.yaml @@ -24,6 +24,9 @@ inputs: command: description: "Unity command to run." required: false + unityBuilder: + description: "Whether or not to use the UnityBuilder instead of a Unity command." + required: false runs: using: "composite" steps: @@ -46,6 +49,7 @@ runs: email: ${{ inputs.email }} password: ${{ inputs.password }} command: ${{ inputs.command }} + unityBuilder: ${{ inputs.unityBuilder }} - name: "Remove temporary image." run: | docker image rm ${{ inputs.imageTag }} diff --git a/unity-command/entrypoint.sh b/unity-command/entrypoint.sh index 0e78321..02d65b9 100644 --- a/unity-command/entrypoint.sh +++ b/unity-command/entrypoint.sh @@ -1,5 +1,5 @@ #!/bin/bash -SERIAL=$1; EMAIL=$2; PASSWORD=$3; COMMAND=$4 +SERIAL=$1; EMAIL=$2; PASSWORD=$3; COMMAND=$4; UNITY_BUILDER=$4 DEFAULT_ARGS="-quit -logFile -" rm -rf $HOME/.config/unity3d @@ -32,5 +32,9 @@ else fi #Run the command. -unity-editor $DEFAULT_ARGS $COMMAND +if [[ -n "$UNITY_BUILDER" ]]; then + UnityBuilder $COMMAND +else + unity-editor $DEFAULT_ARGS $COMMAND +fi ls -Al Library \ No newline at end of file diff --git a/unity-command/install-dotnet.sh b/unity-command/install-dotnet.sh deleted file mode 100644 index e87834b..0000000 --- a/unity-command/install-dotnet.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -apt update -apt install wget -y - -#wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb -#dpkg -i packages-microsoft-prod.deb -#rm packages-microsoft-prod.deb -# -#apt update -#apt install -y dotnet-sdk-6.0 - -#For UnityBuilder -apt install -y chromium-browser \ No newline at end of file diff --git a/unity-project/action.yaml b/unity-project/action.yaml index 8896e79..8d6c5f8 100644 --- a/unity-project/action.yaml +++ b/unity-project/action.yaml @@ -21,6 +21,12 @@ inputs: command: description: "Unity command to run." required: false + unityBuilder: + description: "Whether or not to use the UnityBuilder instead of a Unity command." + required: false + cacheVolume: + description: "Name of the volume to cache the Library folder to." + required: false runs: using: "composite" steps: @@ -34,10 +40,11 @@ runs: uses: act/unity/unity-get-buildtarget@master with: platform: ${{ inputs.platform }} - - name: "Library" + - name: "Restore the cached Library folder." + if: ${{ inputs.cacheVolume }} uses: act/common/docker/docker-cp@master with: - volume: library + volume: ${{ inputs.cacheVolume }} toPath: . - name: "Run Unity command." uses: act/unity/unity-command@master @@ -48,8 +55,10 @@ runs: email: ${{ inputs.email }} password: ${{ inputs.password }} command: -projectPath ${{ inputs.projectPath }} -buildTarget ${{ steps.getTarget.outputs.buildTarget }} ${{ inputs.command }} - - uses: act/common/docker/docker-cp@master + - name: "Cache the Library folder." + if: ${{ inputs.cacheVolume }} + uses: act/common/docker/docker-cp@master with: - #recreateVolume: true - volume: library + recreateVolume: true + volume: ${{ inputs.cacheVolume }} fromPath: Library