From dc1979a14cd76b86a779eed09256140afcc41f1e Mon Sep 17 00:00:00 2001 From: n0ctal <4c866w5fn9@privaterelay.appleid.com> Date: Tue, 18 Aug 2026 14:37:03 +0500 Subject: [PATCH] ci(release): stamp released binaries with their source revision (#6223) * ci(release): stamp released binaries with their source revision The release job builds `main.go`, which Go records as a file list rather than a package, so the binary carries no VCS metadata at all: `go version -m xui-release` reports command-line-arguments and nothing else. There is no way to tell which commit a published binary came from, which is exactly what you want when a user reports a bug against "the latest release". Build the package with -buildvcs=true instead. Same output, same flags, plus vcs.revision and vcs.time in the binary. * ci(release): give the Windows job the git it needs to stamp -buildvcs=true fails the build when it cannot read VCS state, and the MSYS2 shell the Windows job runs in has no git on PATH. Install it there so the Windows binary carries the same revision as the Linux ones instead of the flag turning into a build break. --------- Co-authored-by: n0ctal --- .github/workflows/release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8aa5e4101..5a4c654ea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -109,7 +109,7 @@ jobs: if [[ "$GITHUB_REF" != refs/tags/* ]]; then LDFLAGS="$LDFLAGS -X github.com/mhsanaei/3x-ui/v3/internal/config.buildCommit=${GITHUB_SHA::8} -X github.com/mhsanaei/3x-ui/v3/internal/config.buildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ)" fi - go build -ldflags "$LDFLAGS" -o xui-release -v main.go + go build -buildvcs=true -ldflags "$LDFLAGS" -o xui-release -v . file xui-release ldd xui-release || echo "Static binary confirmed" @@ -247,6 +247,7 @@ jobs: msystem: MINGW64 update: true install: >- + git mingw-w64-x86_64-gcc mingw-w64-x86_64-sqlite3 mingw-w64-x86_64-pkg-config @@ -270,7 +271,7 @@ jobs: if [[ "$GITHUB_REF" != refs/tags/* ]]; then LDFLAGS="$LDFLAGS -X github.com/mhsanaei/3x-ui/v3/internal/config.buildCommit=${GITHUB_SHA:0:8} -X github.com/mhsanaei/3x-ui/v3/internal/config.buildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ)" fi - go build -ldflags "$LDFLAGS" -o xui-release.exe -v main.go + go build -buildvcs=true -ldflags "$LDFLAGS" -o xui-release.exe -v . - name: Copy and download resources shell: pwsh