|
24 | 24 | timeout-minutes: 30 |
25 | 25 | env: |
26 | 26 | UNITY_PROJECT_PATH: '' # Set from create-project step |
| 27 | + RUN_BUILD: '' # Set to true if the build pipeline package can be installed and used |
27 | 28 | steps: |
28 | 29 | - uses: actions/checkout@v4 |
29 | 30 | - uses: actions/setup-node@v4 |
@@ -73,15 +74,30 @@ jobs: |
73 | 74 | echo "Error: UNITY_PROJECT_PATH is not set" |
74 | 75 | exit 1 |
75 | 76 | fi |
| 77 | + # check if the project can be built. Only Unity 2019.4+ and newer majors support the build pipeline package |
| 78 | + version="${{ matrix.unity-version }}" |
| 79 | + # extract major and minor (minor may be empty if version is just '2019' etc.) |
| 80 | + major=$(echo "$version" | cut -d'.' -f1) |
| 81 | + minor=$(echo "$version" | cut -d'.' -f2) |
| 82 | + if [ -z "$minor" ]; then |
| 83 | + minor=0 |
| 84 | + fi |
| 85 | + # numeric comparison: enable build for major > 2019 or major == 2019 and minor >= 4 |
| 86 | + if [ "$major" -gt 2019 ] || { [ "$major" -eq 2019 ] && [ "$minor" -ge 4 ]; }; then |
| 87 | + echo "Proceeding with build for Unity version $version" |
| 88 | + echo "RUN_BUILD=true" >> $GITHUB_ENV |
| 89 | + else |
| 90 | + echo "Skipping build: Unity version $version does not support the build pipeline package (requires 2019.4+)" |
| 91 | + fi |
76 | 92 | - name: Install OpenUPM and build pipeline package |
77 | 93 | shell: bash |
78 | | - if: ${{ matrix.unity-version != '4.7.2' && matrix.unity-version != '5.6.7' }} |
| 94 | + if: ${{ env.RUN_BUILD == 'true' }} |
79 | 95 | run: | |
80 | 96 | npm install -g openupm-cli |
81 | 97 | cd "${UNITY_PROJECT_PATH}" |
82 | 98 | openupm add com.utilities.buildpipeline |
83 | 99 | - name: Build project |
84 | | - if: ${{ matrix.unity-version != '4.7.2' && matrix.unity-version != '5.6.7' }} |
| 100 | + if: ${{ env.RUN_BUILD == 'true' }} |
85 | 101 | shell: bash |
86 | 102 | run: | |
87 | 103 | unity-cli run --log-name Validate -quit -nographics -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject -importTMProEssentialsAsset |
|
0 commit comments