From 45296f3cc6486f0a38db1d99cca7e18a885d32d9 Mon Sep 17 00:00:00 2001 From: Frostebite Date: Tue, 25 Aug 2026 19:07:47 +0100 Subject: [PATCH] fix: pass unityVersion through as --engineVersion instead of ignoring it (#847) game-ci/cli#154 fixes the CLI's engine-detection middleware to respect an explicit --engineVersion instead of always overwriting it with the value auto-detected from the checked-out project's ProjectVersion.txt. This was the root cause of PR #844's "WebGL on 6000.0.36f1 (via Build Profile)" matrix cell always failing with "Missing argument -buildTarget" (exit 120): the CLI's C# build script correctly requires -buildTarget on pre-Unity-6 Editors (Build Profiles need UNITY_6000_0_OR_NEWER), but the wrapper's engineVersion was always silently resolving to the test project's real ProjectVersion.txt (2021.3.45f1), not the 6000.0.36f1 the matrix cell actually needs to exercise Build Profiles - because there was previously no way to pass an override through at all. Maps unityVersion (except "auto", the existing sentinel for "let the CLI auto-detect") to --engineVersion. Removes the now-stale core.warning() that told users the input was ignored. Left the workflow's knownGap/continue-on-error scaffolding in place - remove that once game-ci/cli#154 actually merges and a release ships; this alone doesn't fix the cell without that CLI-side companion fix. --- src/build-args.test.ts | 18 ++++++++++++++++++ src/build-args.ts | 23 +++++++++++++++-------- src/index.ts | 9 --------- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/src/build-args.test.ts b/src/build-args.test.ts index 18628436..5a53c072 100644 --- a/src/build-args.test.ts +++ b/src/build-args.test.ts @@ -23,6 +23,24 @@ describe('buildCliArgs', () => { ).toStrictEqual(['build', 'game', '--targetPlatform=StandaloneLinux64']); }); + it('omits --engineVersion when unityVersion is unset or "auto"', () => { + const noneSet = buildCliArgs(inputsOf({ targetPlatform: 'StandaloneLinux64' })); + const explicitAuto = buildCliArgs( + inputsOf({ targetPlatform: 'StandaloneLinux64', unityVersion: 'auto' }), + ); + + expect(noneSet.some((arg) => arg.startsWith('--engineVersion'))).toBe(false); + expect(explicitAuto.some((arg) => arg.startsWith('--engineVersion'))).toBe(false); + }); + + it('maps an explicit unityVersion to --engineVersion, overriding auto-detection', () => { + const args = buildCliArgs( + inputsOf({ targetPlatform: 'WebGL', unityVersion: '6000.0.36f1' }), + ); + + expect(args).toContain('--engineVersion=6000.0.36f1'); + }); + it('throws for a non-local providerStrategy, matching the base action without @game-ci/orchestrator', () => { expect(() => buildCliArgs(inputsOf({ targetPlatform: 'StandaloneLinux64', providerStrategy: 'aws' })), diff --git a/src/build-args.ts b/src/build-args.ts index 05a02941..665bbd7e 100644 --- a/src/build-args.ts +++ b/src/build-args.ts @@ -2,18 +2,20 @@ * Translates unity-builder's action inputs into `game-ci build` (or, for * providerStrategy=local-system, `game-ci orchestrate`) CLI flags. * - * Two deliberate omissions for the `build` path, both because there is - * nothing to translate to: - * - `unityVersion` (except "auto"): the CLI always detects the Unity - * version from the checked-out project's ProjectSettings/ProjectVersion.txt - * and has no flag to override that today (game-ci/cli's engine-detection - * middleware unconditionally overwrites any passed value). Pinning a - * version other than "auto" is a known, real gap versus the original - * action - see the PR this shipped in. + * One deliberate omission for the `build` path, because there is nothing + * to translate to: * - `providerStrategy` values other than "local"/"local-system": the base * action (without the separately-installed @game-ci/orchestrator plugin) * already throws for these today, so throwing here isn't a regression. * + * `unityVersion` (except "auto", which means "let the CLI auto-detect from + * ProjectSettings/ProjectVersion.txt", so it's never passed through as a + * literal flag value): mapped to `--engineVersion`, which game-ci/cli's + * engine-detection middleware now respects instead of unconditionally + * overwriting (game-ci/cli#154). Not carried into ORCHESTRATE_STRING_FLAGS - + * unverified whether `orchestrate`'s local-system path reads engineVersion + * the same way; scope this out until confirmed. + * * Boolean inputs use GitHub Actions' own truthy/falsy string convention * ('true'/'false', case-insensitive) - see actions/toolkit's getBooleanInput. */ @@ -236,6 +238,11 @@ export function buildCliArgs({ getInput }: BuildArgsOptions): string[] { } args.push(`--targetPlatform=${targetPlatform}`); + const unityVersion = getInput('unityVersion'); + if (unityVersion && unityVersion !== 'auto') { + args.push(`--engineVersion=${unityVersion}`); + } + pushStringFlags(args, getInput, STRING_FLAGS); pushBooleanFlags(args, getInput, BOOLEAN_FLAGS); diff --git a/src/index.ts b/src/index.ts index 1a27ff24..1bcf00c8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,15 +18,6 @@ import { resolveProjectPath } from './resolve-project-path'; export async function run() { try { - const unityVersion = core.getInput('unityVersion') || 'auto'; - if (unityVersion !== 'auto') { - core.warning( - `unityVersion="${unityVersion}" is ignored: the underlying game-ci CLI always detects the Unity ` + - "version from the checked-out project's ProjectSettings/ProjectVersion.txt and has no flag to " + - 'override it yet.', - ); - } - const cliVersion = core.getInput('cliVersion') || 'latest'; const cliPath = await downloadCli(cliVersion);