From 694c315276f9b6cb27c0e017758d7b5b54ce531f Mon Sep 17 00:00:00 2001 From: Txema Martinez <67916558+txema-martinez-scopely@users.noreply.github.com> Date: Mon, 22 Mar 2021 16:14:11 +0100 Subject: [PATCH] Run license activation in an empty directory (#109) * Run license activation in an empty directory * Create license directory in entrypoint.sh --- action/entrypoint.sh | 13 +++++++++++++ action/steps/activate.sh | 7 +++++++ action/steps/return_license.sh | 7 +++++++ 3 files changed, 27 insertions(+) diff --git a/action/entrypoint.sh b/action/entrypoint.sh index 6d4eed5..0b5b703 100644 --- a/action/entrypoint.sh +++ b/action/entrypoint.sh @@ -1,5 +1,12 @@ #!/usr/bin/env bash +# +# Create directory for license activation +# + +ACTIVATE_LICENSE_PATH="$GITHUB_WORKSPACE/_activate-license" +mkdir -p "$ACTIVATE_LICENSE_PATH" + # # Run steps # @@ -8,6 +15,12 @@ source /steps/activate.sh source /steps/run_tests.sh source /steps/return_license.sh +# +# Remove license activation directory +# + +rm -r "$ACTIVATE_LICENSE_PATH" + # # Instructions for debugging # diff --git a/action/steps/activate.sh b/action/steps/activate.sh index d41ded0..707afa7 100644 --- a/action/steps/activate.sh +++ b/action/steps/activate.sh @@ -1,5 +1,9 @@ #!/usr/bin/env bash +# Run in ACTIVATE_LICENSE_PATH directory +echo "Changing to \"$ACTIVATE_LICENSE_PATH\" directory." +pushd "$ACTIVATE_LICENSE_PATH" + if [[ -n "$UNITY_LICENSE" ]] || [[ -n "$UNITY_LICENSE_FILE" ]]; then # # PERSONAL LICENSE MODE @@ -102,3 +106,6 @@ else echo "Exit code was: $UNITY_EXIT_CODE" exit $UNITY_EXIT_CODE fi + +# Return to previous working directory +popd diff --git a/action/steps/return_license.sh b/action/steps/return_license.sh index 96532a7..46f8120 100644 --- a/action/steps/return_license.sh +++ b/action/steps/return_license.sh @@ -1,5 +1,9 @@ #!/usr/bin/env bash +# Run in ACTIVATE_LICENSE_PATH directory +echo "Changing to \"$ACTIVATE_LICENSE_PATH\" directory." +pushd "$ACTIVATE_LICENSE_PATH" + if [[ -n "$UNITY_SERIAL" ]]; then # # PROFESSIONAL (SERIAL) LICENSE MODE @@ -13,3 +17,6 @@ if [[ -n "$UNITY_SERIAL" ]]; then -quit \ -returnlicense fi + +# Return to previous working directory +popd