Skip to content

fix(build): read tip version from tarball VERSION file - #165

Merged
psadi merged 1 commit into
mainfrom
fix/tip-version-detection
Sep 30, 2026
Merged

psadi merged 1 commit into
mainfrom
fix/tip-version-detection

Conversation

@psadi

@psadi psadi commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

Problem

Nightly (tip) builds started failing:

+ cd ghostty-1.3.2-main+5b435d5-build.zig.zon.txt
./bin/build-ghostty.sh: line 72: cd: ghostty-1.3.2-main+5b435d5-build.zig.zon.txt: No such file or directory

Failing run: https://github.com/pkgforge-dev/ghostty-appimage/actions/runs/36660278577

Root cause

The tip version was parsed by splitting the tarball's top-level directory on hyphens and taking fields 2–4:

ghostty-1.3.2-main+5b435d5/build.zig.zon.txt
  -> 1.3.2-main+5b435d5-build.zig.zon.txt

Upstream changed the tip version scheme from main-<hash> to semver build metadata main+<hash> (Config.zig: .pre = branch, .build = short_hash). The hash merged into the branch field, so field 4 became the file name and produced an invalid version.

This cascaded into cat ghostty-<bogus>/build.zig.zon failing (leaving ZIG_VERSION empty and printing the misleading Zig is already installed), then cd ghostty-<bogus> failing under set -e.

Fix

Ghostty embeds a canonical VERSION file at <tarball-root>/VERSION, so read the version directly from it instead of parsing the directory name. Also fail fast on empty detection, and use --no-wildcards-match-slash so only the top-level VERSION is matched (nested files can never leak in).

Verification

  • Tested against the live tip tarball: resolves 1.3.2-main+26e64df, matching the extracted directory.
  • Full tip-branch flow simulated: tarball rename → VERSION write → extract → cd target exists → ZIG_VERSION=0.16.0.
  • sh -n and pre-commit (shellcheck, shfmt) pass.

Nightly builds fail because the tip version is parsed by splitting the
tarball's top-level directory on hyphens and taking fields 2-4:

  ghostty-1.3.2-main+5b435d5/build.zig.zon.txt
  -> 1.3.2-main+5b435d5-build.zig.zon.txt

Upstream changed the tip version scheme from `main-<hash>` to semver
build metadata `main+<hash>` (Config.zig: .pre = branch,
.build = short_hash), so the commit hash merged into the branch field
and field 4 became the file name.

This cascaded into `cat ghostty-<bogus>/build.zig.zon` failing (leaving
ZIG_VERSION empty and Zig skipped) and then `cd ghostty-<bogus>` failing.

Ghostty embeds a canonical VERSION file at <tarball-root>/VERSION, so
read the version directly from it instead of parsing the directory name.
Fail fast if detection yields an empty value, and use
--no-wildcards-match-slash so only the top-level VERSION is matched.

Failing run: https://github.com/pkgforge-dev/ghostty-appimage/actions/runs/36660278577
@psadi
psadi merged commit 4330962 into main Sep 30, 2026
7 checks passed
@psadi
psadi deleted the fix/tip-version-detection branch September 30, 2026 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant