Commit 801729b
authored
fix(cli): inject version into Go binary via ldflags (#5313)
## What changed
Pass the npm release version into the bundled `supabase-go` binary via
`-ldflags -X github.com/supabase/cli/internal/utils.Version=...` in
`apps/cli/scripts/build.ts`.
## Why
The legacy CLI shell forwards most commands to the bundled Go binary.
That binary's upgrade banner reports the currently installed version
from `utils.Version`, which is a string assigned at compile time via
`-ldflags -X`. The Bun build script was only passing `-s -w`, so every
release shipped a Go binary with `utils.Version=""`. The user-visible
symptom was:
```
A new version of Supabase CLI is available: v2.100.1 (currently installed v)
```
`semver.Compare` treats the empty string as less than any valid version,
so the upgrade prompt fired on every invocation regardless of the
installed version.
The `-X` injection had been part of the prior `.goreleaser.yml` build
but was dropped during the goreleaser → Bun build-script migration. The
bug only became user-visible once the `beta` and `stable` channels
started building `shell=legacy` again, which is what bundles
`supabase-go` into the release tarballs.
## Reviewer notes
- The npm version (no leading `v`) is the right form to inject —
`apps/cli-go/cmd/root.go:199` constructs `"v"+utils.Version` for the
comparison and other callsites use the raw value.
- The same migration also dropped `-X` injections for `utils.SentryDsn`,
`utils.PostHogAPIKey`, and `utils.PostHogEndpoint`. The Go binary in
current releases runs without Sentry/PostHog credentials. Out of scope
for this PR — worth a separate ticket so the secret-handling and
CI-secret wiring can be designed deliberately.
Fixes #53081 parent a6e21f7 commit 801729b
1 file changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
| 129 | + | |
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| |||
0 commit comments