|
1 | | -name: Unity Build |
2 | | - |
3 | | -on: |
4 | | - push: |
5 | | - branches: [ "main" ] |
6 | | - pull_request: |
7 | | - branches: [ "main" ] |
8 | | - |
9 | 1 | jobs: |
10 | 2 | build: |
11 | 3 | runs-on: ubuntu-latest |
12 | 4 | steps: |
13 | | - # 1. Checkout the repository |
14 | 5 | - uses: actions/checkout@v3 |
15 | 6 |
|
16 | | - # 2. Get Unity version from ProjectSettings/ProjectVersion.txt |
17 | 7 | - name: Get Unity Version |
18 | 8 | id: get-unity-version |
19 | 9 | run: | |
20 | 10 | version=$(grep "^m_EditorVersion:" ProjectSettings/ProjectVersion.txt | sed 's/m_EditorVersion: //') |
21 | 11 | echo "version=$version" >> $GITHUB_OUTPUT |
22 | 12 |
|
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 | 13 | - name: Unity - Activate |
39 | | - if: env.UNITY_LICENSE != '' |
40 | 14 | uses: game-ci/unity-activate@v2 |
41 | 15 | with: |
42 | 16 | unityVersion: ${{ steps.get-unity-version.outputs.version }} |
43 | 17 | env: |
44 | | - UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} |
| 18 | + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} |
| 19 | + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} |
| 20 | + UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} |
45 | 21 |
|
46 | | - # 6. Build Unity project |
47 | 22 | - name: Unity - Build |
48 | 23 | uses: game-ci/unity-builder@v4 |
49 | 24 | with: |
50 | 25 | unityVersion: ${{ steps.get-unity-version.outputs.version }} |
51 | | - targetPlatform: Android # change to StandaloneWindows/IOS/etc. |
| 26 | + targetPlatform: Android |
0 commit comments