From b756313679237e1dbd4dfe9a65f10d5df92c5293 Mon Sep 17 00:00:00 2001 From: kjake Date: Fri, 24 Jul 2026 13:41:00 -0400 Subject: [PATCH] fix(build): stamp release tag into BSD binary version The BSD build runs while the GitHub release is still a draft, so the git tag (e.g. 2026.7.3) does not exist yet at build time. The Makefile derives main.Version from `git describe --tags`, which then falls back to a bare commit SHA, so `cloudflared --version` reported e.g. "a83dfa20" instead of "2026.7.3" and users could not tell which release they were running. Pass VERSION= explicitly to gmake in all three BSD build steps. A command-line VERSION overrides the Makefile's git-describe value in GNU make, so the binary is stamped with the real release version regardless of whether the tag exists at build time. Restores the behavior of older releases (e.g. 2025.9.1 correctly reported "cloudflared version 2025.9.1"). --- .github/workflows/build_unix.yaml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_unix.yaml b/.github/workflows/build_unix.yaml index d2942aee5b0..dbee9cce631 100644 --- a/.github/workflows/build_unix.yaml +++ b/.github/workflows/build_unix.yaml @@ -106,7 +106,11 @@ jobs: # Upstream's vendor tree is already complete; trust it. go mod download go install golang.org/x/tools/cmd/goimports@latest - gmake cloudflared + # Stamp the release tag into the binary (main.Version). The build + # runs while the GitHub release is still a draft, so the git tag + # does not exist yet and the Makefile's `git describe` would fall + # back to a bare commit SHA. Passing VERSION explicitly overrides it. + gmake cloudflared VERSION="${{ steps.get_release.outputs.tag_name }}" # Build step for NetBSD - name: Build from Source on NetBSD @@ -134,7 +138,11 @@ jobs: # Upstream's vendor tree is already complete; trust it. go mod download go install golang.org/x/tools/cmd/goimports@latest - gmake cloudflared + # Stamp the release tag into the binary (main.Version). The build + # runs while the GitHub release is still a draft, so the git tag + # does not exist yet and the Makefile's `git describe` would fall + # back to a bare commit SHA. Passing VERSION explicitly overrides it. + gmake cloudflared VERSION="${{ steps.get_release.outputs.tag_name }}" # Build step for OpenBSD - name: Build from Source on OpenBSD @@ -156,7 +164,11 @@ jobs: # Upstream's vendor tree is already complete; trust it. go mod download go install golang.org/x/tools/cmd/goimports@latest - gmake cloudflared + # Stamp the release tag into the binary (main.Version). The build + # runs while the GitHub release is still a draft, so the git tag + # does not exist yet and the Makefile's `git describe` would fall + # back to a bare commit SHA. Passing VERSION explicitly overrides it. + gmake cloudflared VERSION="${{ steps.get_release.outputs.tag_name }}" - name: Authenticate GH CLI run: echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token