@@ -2,49 +2,41 @@ name: Unity Build
22
33on :
44 push :
5- branches : [ "main" ] # Run on push to main
5+ branches : [ "main" ]
66 pull_request :
7- branches : [ "main" ] # Run on PRs targeting main
8- workflow_dispatch : # Allow manual run from Actions tab
7+ branches : [ "main" ]
8+ workflow_dispatch :
99
1010jobs :
1111 build :
1212 runs-on : ubuntu-latest
1313 steps :
1414 # 1. Checkout project
15- - uses : actions/checkout@v3
15+ - name : Checkout project
16+ uses : actions/checkout@v3
1617
17- # 2. Detect Unity version
18+ # 2. Get Unity Version from ProjectSettings/ProjectVersion.txt
1819 - name : Get Unity Version
1920 id : get-unity-version
2021 run : |
2122 version=$(grep "^m_EditorVersion:" ProjectSettings/ProjectVersion.txt | sed 's/m_EditorVersion: //')
2223 echo "version=$version" >> $GITHUB_OUTPUT
2324
24- # 3. Request activation file (first run only)
25- - name : Unity - Request Activation File
26- uses : game-ci/unity-request-activation-file@v2
25+ # 3. Build the project
26+ # This single step now handles activation and building
27+ - name : Unity - Build
28+ uses : game-ci/unity-builder@v4
29+ env :
30+ UNITY_LICENSE : ${{ secrets.UNITY_LICENSE }}
31+ UNITY_EMAIL : ${{ secrets.UNITY_EMAIL }}
32+ UNITY_PASSWORD : ${{ secrets.UNITY_PASSWORD }}
2733 with :
2834 unityVersion : ${{ steps.get-unity-version.outputs.version }}
35+ targetPlatform : Android # Or whatever platform you need
2936
30- - name : Upload activation file
37+ # (Optional) 4. Upload build artifact
38+ - name : Upload Build Artifact
3139 uses : actions/upload-artifact@v4
3240 with :
33- name : Unity_ActivationFile
34- path : Unity_*.alf
35-
36- # 4. Activate (after you upload UNITY_LICENSE secret from .ulf file)
37- - name : Unity - Activate
38- if : env.UNITY_LICENSE != ''
39- uses : game-ci/unity-activate@v2
40- with :
41- unityVersion : ${{ steps.get-unity-version.outputs.version }}
42- env :
43- UNITY_LICENSE : ${{ secrets.UNITY_LICENSE }}
44-
45- # 5. Build
46- - name : Unity - Build
47- uses : game-ci/unity-builder@v4
48- with :
49- unityVersion : ${{ steps.get-unity-version.outputs.version }}
50- targetPlatform : Android # Change to WebGL, StandaloneWindows, iOS, etc.
41+ name : build-${{ steps.build.outputs.buildPath }}
42+ path : ${{ steps.build.outputs.buildPath }}
0 commit comments