propagate changes from builder

This commit is contained in:
Webber
2020-01-21 21:41:35 +01:00
committed by Webber Takken
parent 5e03b210c2
commit 7358ec3716

View File

@@ -6,10 +6,11 @@ if [[ -n "$UNITY_LICENSE" ]]; then
# #
# This will activate Unity, using a license file # This will activate Unity, using a license file
# #
# Note that this is the ONLY WAY for PERSONAL LICENSES in 2019. # Note that this is the ONLY WAY for PERSONAL LICENSES in 2020.
# * See for more details: https://gitlab.com/gableroux/unity3d-gitlab-ci-example/issues/5#note_72815478 # * See for more details: https://gitlab.com/gableroux/unity3d-gitlab-ci-example/issues/5#note_72815478
# #
# The license file can be acquired using `webbertakken/request-manual-activation-file` action. # The license file can be acquired using `webbertakken/request-manual-activation-file` action.
echo "Requesting activation (personal license)"
# Set the license file path # Set the license file path
FILE_PATH=UnityLicenseFile.ulf FILE_PATH=UnityLicenseFile.ulf
@@ -17,52 +18,36 @@ if [[ -n "$UNITY_LICENSE" ]]; then
# Copy license file from Github variables # Copy license file from Github variables
echo "$UNITY_LICENSE" | tr -d '\r' > $FILE_PATH echo "$UNITY_LICENSE" | tr -d '\r' > $FILE_PATH
## # Activate license
## Activate license ACTIVATION_OUTPUT=$(xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
##
echo "Requesting activation"
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
/opt/Unity/Editor/Unity \ /opt/Unity/Editor/Unity \
-batchmode \ -batchmode \
-nographics \ -nographics \
-logFile /dev/stdout \ -logFile /dev/stdout \
-quit \ -quit \
-manualLicenseFile $FILE_PATH -manualLicenseFile $FILE_PATH)
# This is expected to always exit with code 1 (both success and failure).
# Convert to exit code 0 by echoing the current exit code.
echo $?
# Exit code is now 0
##
## Verify activated license
##
echo "Verifying activation"
# Run any command that requires activation to verify
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
/opt/Unity/Editor/Unity \
-batchmode \
-nographics \
-logFile /dev/stdout \
-quit
# Store the exit code from the verify command # Store the exit code from the verify command
UNITY_EXIT_CODE=$? UNITY_EXIT_CODE=$?
# Display information about the result # The exit code for personal activation is always 1;
if [ $UNITY_EXIT_CODE -eq 0 ]; then # Determine whether activation was successful.
echo "Activation (personal) complete." #
else # Successful output should include the following:
echo "Unclassified error occured while trying to activate (personal) license." #
echo "Exit code was: $UNITY_EXIT_CODE" # "LICENSE SYSTEM [2020120 18:51:20] Next license update check is after 2019-11-25T18:23:38"
fi #
ACTIVATION_SUCCESSFUL=$(echo $ACTIVATION_OUTPUT | grep 'Next license update check is after' | wc -l)
# Set exit code to 0 if activation was successful
if [[ $ACTIVATION_SUCCESSFUL -eq 1 ]]; then
UNITY_EXIT_CODE=0
fi;
# Remove license file # Remove license file
rm -f $FILE_PATH rm -f $FILE_PATH
# Exit with the code from the license verification step elif [[ -n "$UNITY_SERIAL" && -n "$UNITY_EMAIL" && -n "$UNITY_PASSWORD" ]]; then
exit $UNITY_EXIT_CODE
else
# #
# PROFESSIONAL (SERIAL) LICENSE MODE # PROFESSIONAL (SERIAL) LICENSE MODE
# #
@@ -70,6 +55,9 @@ else
# #
# Note: This is the preferred way for PROFESSIONAL LICENSES. # Note: This is the preferred way for PROFESSIONAL LICENSES.
# #
echo "Requesting activation (professional license)"
# Activate license
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \ xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
/opt/Unity/Editor/Unity \ /opt/Unity/Editor/Unity \
-batchmode \ -batchmode \
@@ -83,15 +71,31 @@ else
# Store the exit code from the verify command # Store the exit code from the verify command
UNITY_EXIT_CODE=$? UNITY_EXIT_CODE=$?
# Display information about the result else
if [ $UNITY_EXIT_CODE -eq 0 ]; then #
echo "Activation (professional) complete." # NO LICENSE ACTIVATION STRATEGY MATCHED
else #
echo "Unclassified error occured while trying to activate (professional) license." # This will exit since no activation strategies could be matched.
echo "Exit code was: $UNITY_EXIT_CODE" #
fi echo "License activation strategy could not be determined."
echo ""
echo "Visit https://github.com/webbertakken/unity-builder#usage for more"
echo "details on how to set up one of the possible activation strategies."
# Exit with the code from the license verification step # Immediately exit as no UNITY_EXIT_CODE can be derrived.
exit $UNITY_EXIT_CODE exit 1;
fi fi
#
# Display information about the result
#
if [ $UNITY_EXIT_CODE -eq 0 ]; then
# Activation was a success
echo "Activation complete."
else
# Activation failed so exit with the code from the license verification step
echo "Unclassified error occured while trying to activate license."
echo "Exit code was: $UNITY_EXIT_CODE"
exit $UNITY_EXIT_CODE
fi