Skip to content

Stamp the build version from git instead of a hand-maintained string - #28

Merged
brocla merged 1 commit into
mainfrom
stamp-build-version
Sep 10, 2026
Merged

Stamp the build version from git instead of a hand-maintained string#28
brocla merged 1 commit into
mainfrom
stamp-build-version

Conversation

@brocla

@brocla brocla commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add scripts/Build-FileMill.ps1: builds bin\filemill.exe with -ldflags "-X main.version=$(git describe --tags --dirty --always)", so --version and the webhook startup log line always name the exact commit that was built.
  • Point every documented rebuild path at the new script: the initial setup instructions, the "after a code change" deploy sequence, and Start-FileMill.ps1's missing-binary error message.
  • version's fallback default changes from the stale hardcoded "0.1.1" to "dev", so a binary built by hand (bypassing the script) is obviously identifiable as unstamped rather than silently claiming a specific version number that will only drift again the same way it just did.

Motivated directly by tonight's job-sweep deploy: the binary running in production right now claims 0.1.1 even though it's well past v0.2.0, because nobody passed -ldflags by hand for that rebuild — which was always the plan per the original comment on version, just never actually wired into anything.

Test plan

  • go build ./..., go vet ./..., go test ./... -count=1
  • Ran the new script against a throwaway output path (not the shared bin\filemill.exe) and confirmed --version reports v0.2.0-2-g847f43b-dirty — correct given 2 commits past the v0.2.0 tag and an uncommitted working tree at the time

🤖 Generated with Claude Code

version has been a hardcoded literal since day one, only ever correct if
someone remembered to pass -ldflags by hand -- which nobody did for tonight's
job-sweep deploy, so the running binary claimed "0.1.1" while running code
well past v0.2.0. Add scripts/Build-FileMill.ps1, which stamps the binary
with `git describe --tags --dirty --always` so --version and the webhook
startup line always name the exact commit that was actually built, and
point every documented rebuild step (initial setup, the code-change deploy
sequence, Start-FileMill.ps1's missing-binary error) at it instead of a bare
`go build`.

The fallback default changes from the stale "0.1.1" to "dev", so a binary
built by hand outside the script is obviously identifiable as unstamped
rather than silently claiming a specific version number that will only go
stale again the same way.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@brocla
brocla merged commit 8712efc into main Sep 10, 2026
1 check passed
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