Skip to content

Commit a8557ad

Browse files
update workflow build logic
fixed open-project to search the current directory for project version text files
1 parent 82b0d4c commit a8557ad

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

.github/workflows/unity-build.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
timeout-minutes: 30
2525
env:
2626
UNITY_PROJECT_PATH: '' # Set from create-project step
27+
RUN_BUILD: '' # Set to true if the build pipeline package can be installed and used
2728
steps:
2829
- uses: actions/checkout@v4
2930
- uses: actions/setup-node@v4
@@ -73,15 +74,30 @@ jobs:
7374
echo "Error: UNITY_PROJECT_PATH is not set"
7475
exit 1
7576
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
7692
- name: Install OpenUPM and build pipeline package
7793
shell: bash
78-
if: ${{ matrix.unity-version != '4.7.2' && matrix.unity-version != '5.6.7' }}
94+
if: ${{ env.RUN_BUILD == 'true' }}
7995
run: |
8096
npm install -g openupm-cli
8197
cd "${UNITY_PROJECT_PATH}"
8298
openupm add com.utilities.buildpipeline
8399
- name: Build project
84-
if: ${{ matrix.unity-version != '4.7.2' && matrix.unity-version != '5.6.7' }}
100+
if: ${{ env.RUN_BUILD == 'true' }}
85101
shell: bash
86102
run: |
87103
unity-cli run --log-name Validate -quit -nographics -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject -importTMProEssentialsAsset

src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ program.command('open-project')
332332
}
333333

334334
Logger.instance.debug(JSON.stringify(options));
335-
const projectPath = options.unityProject?.toString()?.trim() || process.env.UNITY_PROJECT_PATH || process.cwd();
335+
const projectPath = options.unityProject?.toString()?.trim() || process.env.UNITY_PROJECT_PATH || undefined;
336336
const unityProject = await UnityProject.GetProject(projectPath);
337337

338338
if (!unityProject) {

0 commit comments

Comments
 (0)