mirror of
https://github.com/game-ci/unity-activate
synced 2026-01-28 21:59:05 +08:00
Add initial version
This commit is contained in:
6
.dockerignore
Normal file
6
.dockerignore
Normal file
@@ -0,0 +1,6 @@
|
||||
# Order ignore, include
|
||||
*
|
||||
|
||||
# Files required for the action
|
||||
!entrypoint.sh
|
||||
!action.yml
|
||||
14
Dockerfile
Normal file
14
Dockerfile
Normal file
@@ -0,0 +1,14 @@
|
||||
FROM gableroux/unity3d:2019.2.11f1
|
||||
|
||||
LABEL "com.github.actions.name"="Unity - Activate"
|
||||
LABEL "com.github.actions.description"="Activate Unity using credentials or a license file. Both personal and professional licenses are supported."
|
||||
LABEL "com.github.actions.icon"="box"
|
||||
LABEL "com.github.actions.color"="gray-dark"
|
||||
|
||||
LABEL "repository"="http://github.com/webbertakken/unity-actions"
|
||||
LABEL "homepage"="http://github.com/webbertakken/unity-actions"
|
||||
LABEL "maintainer"="Webber Takken <webber@takken.io>"
|
||||
|
||||
ADD entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
52
README.md
52
README.md
@@ -2,13 +2,57 @@
|
||||
[](https://github.com/WebberTakken/unity-activate/workflows/Actions%20%F0%9F%98%8E/badge.svg)
|
||||
|
||||
[Github Action](https://github.com/features/actions)
|
||||
to activate Unity using a personal or professional license.
|
||||
to activate Unity using credentials or a license file. Both **personal** and
|
||||
**professional** licenses are supported.
|
||||
|
||||
Use this action to verify whether your license file is correctly configured.
|
||||
|
||||
If so, you will be able to run the
|
||||
Use this action to verify whether your license file is correctly configured. If
|
||||
so, you will be able to run the
|
||||
[Test](https://github.com/webbertakken/unity-actions#test) and
|
||||
[Build](https://github.com/webbertakken/unity-actions#build)
|
||||
actions from the
|
||||
[Unity Actions](https://github.com/webbertakken/unity-actions)
|
||||
collection too.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
#### Personal license
|
||||
|
||||
1. Follow the **activation** section from [request action](https://github.com/marketplace/actions/unity-request-activation-file) to set `UNITY_LICENSE` variable.
|
||||
2. Use the action as follows:
|
||||
|
||||
```yaml
|
||||
- name: Activate Unity
|
||||
uses: webbertakken/unity-activate@v1
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
```
|
||||
|
||||
#### Professional license
|
||||
|
||||
1. Goto `Repository` > `Settings` > `Secrets`
|
||||
2. Set the following secrets:
|
||||
- `UNITY_EMAIL`: <your_unity_login_email_address>
|
||||
- `UNITY_PASSWORD`: <your_unity_login_password>
|
||||
- `UNITY_SERIAL`: <your_unity_serial>
|
||||
3. Use the action as follows:
|
||||
|
||||
```yaml
|
||||
- name: Activate Unity
|
||||
uses: webbertakken/unity-activate@v1
|
||||
env:
|
||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
||||
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
|
||||
```
|
||||
|
||||
_**Note:** I was not able to verify these steps as i don't have a pro license. Feel free
|
||||
to give
|
||||
[feedback](https://github.com/webbertakken/unity-activate/issues/new) or
|
||||
[contribute](https://github.com/webbertakken/unity-activate)._
|
||||
|
||||
## More actions
|
||||
|
||||
Visit
|
||||
[Unity Actions](https://github.com/webbertakken/unity-actions)
|
||||
to find related actions for Unity.
|
||||
|
||||
11
action.yml
Normal file
11
action.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
name: 'Unity - Activate'
|
||||
author: Webber Takken <webber@takken.io>
|
||||
description: 'Activate Unity using credentials or a license file. Both personal and professional licenses are supported.'
|
||||
inputs: {}
|
||||
outputs: {}
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
branding:
|
||||
icon: 'box'
|
||||
color: 'gray-dark'
|
||||
90
entrypoint.sh
Normal file
90
entrypoint.sh
Normal file
@@ -0,0 +1,90 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [[ -n "$UNITY_LICENSE" ]]; then
|
||||
#
|
||||
# PERSONAL LICENSE MODE
|
||||
#
|
||||
# This will activate Unity, using a license file
|
||||
#
|
||||
# Note that this is the ONLY WAY for PERSONAL LICENSES in 2019.
|
||||
# * See for more details: https://gitlab.com/gableroux/unity3d-gitlab-ci-example/issues/5#note_72815478
|
||||
#
|
||||
# The license file can be acquired in two possible ways:
|
||||
# * Utilize `webbertakken/unity-actions/request-manual-activation-file`
|
||||
# * Copy from your local machine (may be unstable due to different server specs)
|
||||
# - Windows: C:/ProgramData/Unity/Unity_lic.ulf
|
||||
# - MacOS: /Library/Application Support/Unity/Unity_lic.ulf
|
||||
# - Linux: -
|
||||
#
|
||||
# CLI arguments reference: https://docs.unity3d.com/Manual/CommandLineArguments.html
|
||||
|
||||
# Set the license file path
|
||||
FILE_PATH=UnityLicenseFile.ulf
|
||||
|
||||
# Copy license file from Github variables
|
||||
echo "$UNITY_LICENSE" | tr -d '\r' > $FILE_PATH
|
||||
echo "$UNITY_LICENSE" | tr -d '\r' > /root/.local/share/unity3d/Unity/Unity_lic.ulf
|
||||
|
||||
##
|
||||
## Activate license
|
||||
##
|
||||
echo "Requesting activation"
|
||||
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
|
||||
/opt/Unity/Editor/Unity \
|
||||
-batchmode \
|
||||
-nographics \
|
||||
-logFile /dev/stdout \
|
||||
-quit \
|
||||
-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
|
||||
UNITY_EXIT_CODE=$?
|
||||
|
||||
# Display information about the result
|
||||
if [ $UNITY_EXIT_CODE -eq 0 ]; then
|
||||
echo "Activation complete"
|
||||
else
|
||||
echo "Unclassified error occured while trying to activate license"
|
||||
echo "Exit code was: $UNITY_EXIT_CODE"
|
||||
fi
|
||||
|
||||
# Exit with the code from the license verification step
|
||||
exit $UNITY_EXIT_CODE
|
||||
|
||||
else
|
||||
#
|
||||
# PROFESSIONAL (SERIAL) LICENSE MODE
|
||||
#
|
||||
# This will activate unity, using the activating process.
|
||||
#
|
||||
# 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 \
|
||||
-batchmode \
|
||||
-nographics \
|
||||
-logFile /dev/stdout \
|
||||
-quit \
|
||||
-serial "$UNITY_SERIAL" \
|
||||
-username "$UNITY_EMAIL" \
|
||||
-password "$UNITY_PASSWORD"
|
||||
|
||||
fi
|
||||
Reference in New Issue
Block a user