mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-09-29 12:07:05 -07:00
cliVersion defaults to 'latest', and caching was previously skipped entirely for it - only pinned versions (cliVersion: v0.1.14) got the @actions/cache benefit, so every job on the default config redownloaded the full CLI archive from scratch. Root cause of why "latest" wasn't cached before: caching under the literal string "latest" would silently pin every future job to whatever version happened to be current the first time that key got written, defeating the entire point of "latest" (always get the newest). Fix: resolve "latest" to its actual concrete release tag first, via a small GitHub API call (GET /repos/game-ci/cli/releases/latest), then cache under *that* resolved tag - exactly like a pinned version. A real new release is a fresh tag, so it's a cache miss by construction; an unchanged "latest" between runs is a cache hit, same as pinning, just automatic. Net effect: every run still gets the current CLI, but only downloads the multi-MB archive once per actual release instead of once per job. Verification: - yarn typecheck: clean. - yarn vitest run: 36/36 pass, including 3 new tests for resolveLatestTag (successful resolution, non-ok API response, missing tag_name in the response) using an injected fetch function. - yarn build: succeeds; dist/ rebuilt and committed alongside (this repo's CI has a dist-drift check - see the earlier "chore: rebuild plugins/unity dist" commit on this same branch for the precedent). - oxfmt --check: clean.