Skip to content

Commit 1e6788e

Browse files
authored
Merge pull request #102 from IShix-g/release
Refactor license handling in workflows
2 parents 6e01dd2 + 3908b4f commit 1e6788e

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

.github/workflows/reusable-build-package.yaml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,14 @@ on:
4242
type: string
4343
default: ''
4444
secrets:
45-
UNITY_LICENSE:
46-
required: true
4745
UNITY_EMAIL:
4846
required: true
4947
UNITY_PASSWORD:
5048
required: true
49+
UNITY_LICENSE:
50+
required: false
51+
UNITY_SERIAL:
52+
required: false
5153
outputs:
5254
export-path:
5355
description: 'Export path where the package was generated'
@@ -102,6 +104,19 @@ jobs:
102104
fetch-depth: 0
103105
lfs: true
104106

107+
- name: Set Unity License Environment
108+
id: unity-license
109+
run: |
110+
if [ -n "${{ secrets.UNITY_LICENSE }}" ]; then
111+
echo "name=UNITY_LICENSE" >> "$GITHUB_OUTPUT"
112+
elif [ -n "${{ secrets.UNITY_SERIAL }}" ]; then
113+
echo "name=UNITY_SERIAL" >> "$GITHUB_OUTPUT"
114+
else
115+
echo "::error::No license or serial found."
116+
exit 1
117+
fi
118+
echo "::notice title=License::$name"
119+
105120
- uses: actions/cache@v4
106121
with:
107122
path: Library
@@ -110,9 +125,9 @@ jobs:
110125

111126
- uses: game-ci/unity-builder@v4
112127
env:
113-
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
114128
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
115129
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
130+
${{ steps.license.outputs.name }}: ${{ secrets[steps.license.outputs.name] }}
116131
with:
117132
targetPlatform: StandaloneLinux64
118133
unityVersion: ${{ inputs.unity-version }}

.github/workflows/test-build-package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ jobs:
3030
build-package:
3131
uses: ./.github/workflows/reusable-build-package.yaml
3232
secrets:
33-
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
3433
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
3534
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
35+
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
3636
with:
3737
package-name: 'Test'
3838
tag: '1.0.0'

0 commit comments

Comments
 (0)