@@ -2,28 +2,50 @@ name: Unity Build
22
33on :
44 push :
5- branches :
6- - main
5+ branches : [ "main" ]
76 pull_request :
7+ branches : [ "main" ]
88
99jobs :
1010 build :
11- name : Build project
1211 runs-on : ubuntu-latest
13-
1412 steps :
15- - name : Checkout repository
16- uses : actions/checkout@v4
13+ # 1. Checkout the repository
14+ - uses : actions/checkout@v3
1715
16+ # 2. Get Unity version from ProjectSettings/ProjectVersion.txt
1817 - name : Get Unity Version
1918 id : get-unity-version
2019 run : |
2120 version=$(grep "^m_EditorVersion:" ProjectSettings/ProjectVersion.txt | sed 's/m_EditorVersion: //')
2221 echo "version=$version" >> $GITHUB_OUTPUT
2322
23+ # 3. Request Unity activation (only needed once to generate .alf file)
24+ - name : Unity - Request Activation File
25+ uses : game-ci/unity-request-activation-file@v2
26+ with :
27+ unityVersion : ${{ steps.get-unity-version.outputs.version }}
28+ # This step will output: Unity_v20XX.x.alf (activation file)
29+
30+ # 4. Upload activation file as artifact so you can download it
31+ - name : Upload activation file
32+ uses : actions/upload-artifact@v3
33+ with :
34+ name : Unity_ActivationFile
35+ path : Unity_*.alf
36+
37+ # 5. If UNITY_LICENSE secret is available, activate Unity
38+ - name : Unity - Activate
39+ if : env.UNITY_LICENSE != ''
40+ uses : game-ci/unity-activate@v2
41+ with :
42+ unityVersion : ${{ steps.get-unity-version.outputs.version }}
43+ env :
44+ UNITY_LICENSE : ${{ secrets.UNITY_LICENSE }}
2445
25- - name : Build project
46+ # 6. Build Unity project
47+ - name : Unity - Build
2648 uses : game-ci/unity-builder@v4
2749 with :
2850 unityVersion : ${{ steps.get-unity-version.outputs.version }}
29- targetPlatform : StandaloneWindows64 # Change to WebGL, Android, iOS etc.
51+ targetPlatform : Android # change to StandaloneWindows/IOS/ etc.
0 commit comments