Skip to content

Commit 1f0b8d5

Browse files
committed
feat: add support for flexible Unity license secrets
1 parent 3e4e416 commit 1f0b8d5

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

.github/workflows/reusable-test-runner.yaml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@ on:
2929
type: string
3030
default: 'generateAdditionalMetrics;generateHtmlReport;generateBadgeReport'
3131
secrets:
32-
UNITY_LICENSE:
33-
required: true
3432
UNITY_EMAIL:
3533
required: true
3634
UNITY_PASSWORD:
3735
required: true
36+
UNITY_LICENSE:
37+
required: false
38+
UNITY_SERIAL:
39+
required: false
3840

3941
jobs:
4042
print-unity-version:
@@ -62,8 +64,28 @@ jobs:
6264
fi
6365
echo "::notice title=Test Modes::$array"
6466
67+
unity-license:
68+
runs-on: ubuntu-22.04
69+
outputs:
70+
name: ${{ steps.license.outputs.name }}
71+
steps:
72+
- name: Set Unity License Name
73+
id: license
74+
run: |
75+
if [ -n "${{ secrets.UNITY_LICENSE }}" ]; then
76+
license_name="UNITY_LICENSE"
77+
elif [ -n "${{ secrets.UNITY_SERIAL }}" ]; then
78+
license_name="UNITY_SERIAL"
79+
else
80+
echo "::error::No secrets.UNITY_LICENSE or secrets.UNITY_SERIAL found."
81+
exit 1
82+
fi
83+
84+
echo "name=$license_name" >> "$GITHUB_OUTPUT"
85+
echo "::notice title=License::$license_name"
86+
6587
test-all:
66-
needs: [prepare-test-modes]
88+
needs: [prepare-test-modes, unity-license]
6789
name: Test in ${{ matrix.testMode }}
6890
runs-on: ubuntu-22.04
6991
timeout-minutes: 15
@@ -86,9 +108,9 @@ jobs:
86108
- uses: game-ci/unity-test-runner@v4
87109
id: tests
88110
env:
89-
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
90111
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
91112
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
113+
${{ needs.unity-license.outputs.name }}: ${{ secrets[needs.unity-license.outputs.name] }}
92114
with:
93115
unityVersion: ${{ inputs.unity-version }}
94116
projectPath: ${{ inputs.project-path }}

0 commit comments

Comments
 (0)