From bd43fe9017838a184f7e003bb6cc916b73bc8b80 Mon Sep 17 00:00:00 2001 From: Webber Date: Sun, 24 Nov 2019 20:15:01 +0100 Subject: [PATCH] Update code for activation script --- .github/workflows/main.yml | 25 +++++++++++++++++++ {activate => request-activation}/Dockerfile | 2 +- {activate => request-activation}/README.md | 0 request-activation/action.yml | 8 ++++++ .../entrypoint.sh | 22 +++++++++++++++- 5 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/main.yml rename {activate => request-activation}/Dockerfile (92%) rename {activate => request-activation}/README.md (100%) create mode 100644 request-activation/action.yml rename {activate => request-activation}/entrypoint.sh (62%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..8a6abc1 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,25 @@ +on: [push] + +jobs: + testWorkflowActions: + runs-on: ubuntu-latest + name: Test the workflow actions + + # Set Unity version + strategy: + matrix: + unity-tag: [2019.2.11f1] # TODO - Reference this tag in all steps + + steps: + + # Checkout repository (required to test local actions) + - name: Checkout repository + uses: actions/checkout@v1 + + # Configure generic activation (local to the actions container) + - name: Request activation + uses: ./request-activation + inputs: + args: + unityLicense: ${{ secrets.UNITY_LICENSE }} + diff --git a/activate/Dockerfile b/request-activation/Dockerfile similarity index 92% rename from activate/Dockerfile rename to request-activation/Dockerfile index c051f0a..92e729e 100644 --- a/activate/Dockerfile +++ b/request-activation/Dockerfile @@ -1,4 +1,4 @@ -FROM gableroux/unity3d:2019.2.11f1-webgl +FROM gableroux/unity3d:2019.2.11f1 LABEL "com.github.actions.name"="Activate Unity" LABEL "com.github.actions.description"="Activate license for Unity editor" diff --git a/activate/README.md b/request-activation/README.md similarity index 100% rename from activate/README.md rename to request-activation/README.md diff --git a/request-activation/action.yml b/request-activation/action.yml new file mode 100644 index 0000000..8d248ed --- /dev/null +++ b/request-activation/action.yml @@ -0,0 +1,8 @@ +name: 'Request activation' +description: 'Request activation using credentials or license file' +inputs: + unityLicense: + description: 'Unity License for activating Unity Personal' +runs: + using: 'docker' + image: 'Dockerfile' diff --git a/activate/entrypoint.sh b/request-activation/entrypoint.sh similarity index 62% rename from activate/entrypoint.sh rename to request-activation/entrypoint.sh index 0cf70db..ab946e8 100644 --- a/activate/entrypoint.sh +++ b/request-activation/entrypoint.sh @@ -15,7 +15,25 @@ if [[ ! -z "$UNITY_LICENSE" ]]; then # * Windows: C:/ProgramData/Unity/Unity_lic.ulf # * MacOS: /Library/Application Support/Unity/Unity_lic.ulf # - echo "$UNITY_LICENSE" > /root/.local/share/unity3d/Unity/Unity_lic.ulf + + # Set the license file path + FILE_PATH=UnityLicenseFile.ulf + + # Copy license file from Github variables + echo "$UNITY_LICENSE" > $FILE_PATH + # echo "$UNITY_LICENSE" > /root/.local/share/unity3d/Unity/Unity_lic.ulf + + # Activate container + # See: https://docs.unity3d.com/Manual/CommandLineArguments.html + echo "Activating Unity" + xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \ + /opt/Unity/Editor/Unity \ + -batchmode \ + -nographics \ + -logFile /dev/stdout \ + -quit \ + -manualLicenseFile Unity_v2019.2.11f1.ulf + else # # PROFESSIONAL (SERIAL) LICENSE MODE @@ -24,6 +42,8 @@ else # # Note: This is the preferred way for PROFESSIONAL LICENSES. # + # TODO - Verify this using some pro license + # xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \ /opt/Unity/Editor/Unity \ -logFile /dev/stdout \