From 7ac35ecc6cd242fbd5e28af7b47e401061313fae Mon Sep 17 00:00:00 2001 From: Webber Date: Sat, 23 Nov 2019 13:32:32 +0100 Subject: [PATCH] Refactor request activation file action to follow good practices --- get-manual-license-file/README.md | 7 ------- get-manual-license-file/entrypoint.sh | 15 -------------- .../Dockerfile | 4 ++-- request-manual-activation-file/README.md | 8 ++++++++ request-manual-activation-file/action.yml | 8 ++++++++ request-manual-activation-file/entrypoint.sh | 20 +++++++++++++++++++ 6 files changed, 38 insertions(+), 24 deletions(-) delete mode 100644 get-manual-license-file/README.md delete mode 100644 get-manual-license-file/entrypoint.sh rename {get-manual-license-file => request-manual-activation-file}/Dockerfile (69%) create mode 100644 request-manual-activation-file/README.md create mode 100644 request-manual-activation-file/action.yml create mode 100644 request-manual-activation-file/entrypoint.sh diff --git a/get-manual-license-file/README.md b/get-manual-license-file/README.md deleted file mode 100644 index 8e53a0a..0000000 --- a/get-manual-license-file/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Get manual license file - -Acquires manual license file for activating CI license. - -## Usage - -Unknown so far diff --git a/get-manual-license-file/entrypoint.sh b/get-manual-license-file/entrypoint.sh deleted file mode 100644 index 18ac8f9..0000000 --- a/get-manual-license-file/entrypoint.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -set -e - -xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \ - /opt/Unity/Editor/Unity \ - -batchmode \ - -nographics \ - -logFile /dev/stdout \ - -createManualActivationFile - -echo "Use this file for manual activation and add it to \$UNITY_LICENSE variabe." -cat Unity_v2019.2.11f1.alf - -cp Unity_v2019.2.11f1.alf $HOME/Unity_v2019.2.11f1.alf diff --git a/get-manual-license-file/Dockerfile b/request-manual-activation-file/Dockerfile similarity index 69% rename from get-manual-license-file/Dockerfile rename to request-manual-activation-file/Dockerfile index 07583cd..26388e0 100644 --- a/get-manual-license-file/Dockerfile +++ b/request-manual-activation-file/Dockerfile @@ -1,7 +1,7 @@ FROM gableroux/unity3d:2019.2.11f1 -LABEL "com.github.actions.name"="Get Unity License File" -LABEL "com.github.actions.description"="Acquire manual license file for Unity editor" +LABEL "com.github.actions.name"="Request Unity Manual Activation File" +LABEL "com.github.actions.description"="Request the manual activation file for activating Unity personal" LABEL "com.github.actions.icon"="box" LABEL "com.github.actions.color"="gray-dark" diff --git a/request-manual-activation-file/README.md b/request-manual-activation-file/README.md new file mode 100644 index 0000000..b3d99ae --- /dev/null +++ b/request-manual-activation-file/README.md @@ -0,0 +1,8 @@ +# Get manual license file + +Acquires manual activation file for activating CI license. + +## Usage + +Please refer to `.github/actions/request.yml` in this repo while the repo is +still a work in progress. diff --git a/request-manual-activation-file/action.yml b/request-manual-activation-file/action.yml new file mode 100644 index 0000000..b0c26dd --- /dev/null +++ b/request-manual-activation-file/action.yml @@ -0,0 +1,8 @@ +name: 'Request manual activation file' +description: 'Request the manual activation file for activating Unity personal' +outputs: + activationFile: + description: 'Manual activation file' +runs: + using: 'docker' + image: 'Dockerfile' diff --git a/request-manual-activation-file/entrypoint.sh b/request-manual-activation-file/entrypoint.sh new file mode 100644 index 0000000..b42ece3 --- /dev/null +++ b/request-manual-activation-file/entrypoint.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# Request the manual activation file for activating unity personal +# Expected output file: "Unity_v${{ unity-tag }}.alf" +xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \ + /opt/Unity/Editor/Unity \ + -batchmode \ + -nographics \ + -logFile /dev/stdout \ + -quit \ + -createManualActivationFile + +# Output the resulting file as an output variable (Strategy 1) +ACTIVATION_FILE=$(cat Unity_v2019.2.11f1.alf) +echo "Use this file for manual activation and add it to \$UNITY_LICENSE variabe." +echo "::add-mask::$ACTIVATION_FILE" +echo "::set-output name=activationFile::$ACTIVATION_FILE" + +# Output the resulting file by copying (Strategy 2) +cp Unity_v2019.2.11f1.alf $HOME/Unity_v2019.2.11f1.alf