|
1 | | -name: Build project |
| 1 | +name: Build |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
|
8 | 8 | workflow_dispatch: {} |
9 | 9 |
|
10 | 10 | jobs: |
11 | | - checklicense: |
12 | | - name: Check for UNITY_LICENSE in GitHub Secrets |
13 | | - runs-on: ubuntu-latest |
14 | | - outputs: |
15 | | - is_unity_license_set: ${{ steps.checklicense_job.outputs.is_unity_license_set }} |
16 | | - steps: |
17 | | - - name: Check whether Unity activation should be done |
18 | | - id: checklicense_job |
19 | | - env: |
20 | | - UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} |
21 | | - UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} |
22 | | - UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} |
23 | | - run: | |
24 | | - if [[ -n "${UNITY_LICENSE}" ]]; then |
25 | | - echo "is_unity_license_set=true" >> $GITHUB_OUTPUT |
26 | | - else |
27 | | - echo "is_unity_license_set=false" >> $GITHUB_OUTPUT |
28 | | - fi |
29 | | -
|
30 | | - buildForAllSupportedPlatforms: |
| 11 | + build: |
31 | 12 | name: Build for ${{ matrix.targetPlatform }} |
32 | | - needs: checklicense |
33 | | - if: needs.checklicense.outputs.is_unity_license_set == 'true' |
34 | 13 | runs-on: ubuntu-latest |
35 | 14 |
|
36 | 15 | strategy: |
37 | 16 | fail-fast: false |
38 | 17 | matrix: |
39 | | - targetPlatform: |
40 | | - - StandaloneWindows64 |
| 18 | + unityVersion: [2022.3.23f1] # Change to your Unity version |
| 19 | + targetPlatform: [StandaloneWindows64] |
41 | 20 |
|
42 | 21 | steps: |
43 | | - - name: Checkout repository and submodules |
| 22 | + - name: Checkout repository |
44 | 23 | uses: actions/checkout@v4 |
45 | 24 | with: |
46 | | - fetch-depth: 0 |
47 | 25 | lfs: true |
48 | | - submodules: 'recursive' |
| 26 | + submodules: true # ⬅️ IMPORTANT for Cesium submodule |
49 | 27 |
|
50 | | - - name: Setup .NET SDK |
51 | | - uses: actions/setup-dotnet@v4 |
| 28 | + - name: Set up cache for Library folder |
| 29 | + uses: actions/cache@v3 |
52 | 30 | with: |
53 | | - dotnet-version: '6.0.x' |
| 31 | + path: Library |
| 32 | + key: Library-${{ matrix.targetPlatform }} |
| 33 | + restore-keys: | |
| 34 | + Library- |
54 | 35 |
|
55 | | - - name: Install Native Build Dependencies |
| 36 | + - name: Install build dependencies |
56 | 37 | run: | |
57 | 38 | sudo apt-get update |
58 | | - sudo apt-get install -y cmake ninja-build clang g++ zip unzip |
| 39 | + sudo apt-get install -y cmake ninja-build g++ python3 |
59 | 40 |
|
60 | | - - name: Build Cesium native plugin |
| 41 | + - name: Build Cesium Native Bindings |
| 42 | + working-directory: Assets/Plugins/CesiumForUnity |
61 | 43 | run: | |
62 | | - mkdir -p Assets/Plugins/CesiumForUnity/native~/build |
63 | | - cd Assets/Plugins/CesiumForUnity/native~/build |
64 | | - cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release |
65 | | - cmake --build . --config Release |
66 | | -
|
67 | | - # This is the new step to generate the C# bindings for Cesium. |
68 | | - - name: Build Cesium C# bindings (Reinterop) |
69 | | - run: dotnet publish Assets/Plugins/CesiumForUnity/Reinterop~ -o Assets/Plugins/CesiumForUnity |
70 | | - |
71 | | - - name: Cache Library folder |
72 | | - uses: actions/cache@v3 |
73 | | - with: |
74 | | - path: Library |
75 | | - key: Library-${{ matrix.targetPlatform }} |
76 | | - restore-keys: Library- |
77 | | - |
78 | | - - name: Free up disk space for Android (if needed) |
79 | | - if: matrix.targetPlatform == 'Android' |
80 | | - uses: jlumbroso/free-disk-space@v1.3.1 |
| 44 | + chmod +x build.sh |
| 45 | + ./build.sh --target UnityEditor |
81 | 46 |
|
82 | | - - name: Build Unity project |
| 47 | + - name: Build with Unity |
83 | 48 | uses: game-ci/unity-builder@v4 |
84 | | - env: |
85 | | - UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} |
86 | | - UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} |
87 | | - UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} |
88 | 49 | with: |
| 50 | + unityVersion: ${{ matrix.unityVersion }} |
| 51 | + projectPath: ./ |
89 | 52 | targetPlatform: ${{ matrix.targetPlatform }} |
90 | 53 |
|
91 | | - - name: Upload build artifact |
| 54 | + - name: Upload Build Artifacts |
92 | 55 | uses: actions/upload-artifact@v4 |
93 | 56 | with: |
94 | 57 | name: Build-${{ matrix.targetPlatform }} |
|
0 commit comments