Skip to content

Commit

Permalink
feat: add create-activation-file job (#22)
Browse files Browse the repository at this point in the history
* refactor: remove empty space

* feat: add `create-activation-file` job

* test: add activation file tests

* fix: job description
  • Loading branch information
EricRibeiro authored Jul 29, 2022
1 parent 5bc316a commit 0e19b68
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,13 @@ jobs:
workflows:
test-build:
jobs:
# Activation file
- unity/create-activation-file:
name: "create-activation-file"
- unity/create-activation-file:
name: "create-activation-file-with-parameter"
editor_version: 2022.1.11f1

# Tests
- test:
name: "test-linux"
Expand Down
23 changes: 23 additions & 0 deletions src/jobs/create-activation-file.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
description: >
Simple drop-in job to create a Unity activation file.
parameters:
editor_version:
description: |
Pick the editor version for the GameCI image.
Available options can be found at https://game.ci/docs/docker/versions.
type: string
default: "2021.3.7f1"

docker:
- image: 'unityci/editor:ubuntu-<<parameters.editor_version>>-base-1'

resource_class: medium

steps:
- checkout
- run:
name: Create Unity activation file
command: << include(scripts/linux/create-activation-file.sh) >>
- store_artifacts:
path: Unity.alf
23 changes: 23 additions & 0 deletions src/scripts/linux/create-activation-file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/false
# shellcheck shell=bash
# shellcheck disable=SC2154

create_manual_activation_file() {
unity-editor \
-batchmode \
-nographics \
-createManualActivationFile \
-quit \
-logfile /dev/null

# Check if license file was created successfully.
if ls Unity_v*.alf &> /dev/null; then return 0; else return 1; fi
}

if ! create_manual_activation_file; then
printf '%s\n' "Failed to create Unity license file."
printf '%s\n' "Please try again or open an issue."
exit 1
fi

mv Unity_v*.alf Unity.alf
1 change: 0 additions & 1 deletion src/scripts/macos/prepare-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
readonly unity_hub_path="/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"
readonly unity_editor_path="/Applications/Unity/Hub/Editor/$UNITY_EDITOR_VERSION/Unity.app/Contents/MacOS/Unity"


printf '%s\n' "export UNITY_HUB_PATH=\"$unity_hub_path\"" >> "$BASH_ENV"
printf '%s\n' "export UNITY_EDITOR_PATH=$unity_editor_path" >> "$BASH_ENV"

Expand Down

0 comments on commit 0e19b68

Please sign in to comment.