[PR #6223] [MERGED] ci(release): stamp released binaries with their source revision #6185

Closed
opened 2026-11-02 04:06:57 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6223
Author: @n0ctal
Created: 8/16/2026
Status: ✅ Merged
Merged: 8/18/2026
Merged by: @MHSanaei

Base: main ← Head: upstream-stamp-release-revision


📝 Commits (2)

  • 32b9768 ci(release): stamp released binaries with their source revision
  • e5f2f5c ci(release): give the Windows job the git it needs to stamp

📊 Changes

1 file changed (+3 additions, -2 deletions)

View changed files

📝 .github/workflows/release.yml (+3 -2)

📄 Description

Summary

The release workflow builds main.go. Go treats a file argument as a file list, records the package path as command-line-arguments, and skips VCS stamping entirely — so published binaries carry no revision.

Building the package instead (.) with -buildvcs=true produces the same binary and adds vcs.revision / vcs.time.

Why

Right now there is no way to map a released binary back to a commit. When a user reports a bug against "the latest release", the version string is all there is, and it does not distinguish rebuilds or tag moves. go version -m is the standard place to look and it currently answers nothing:

$ go version -m xui-release
xui-release: go1.26.6
        path    command-line-arguments

Scope

Two lines in .github/workflows/release.yml — the Linux and the Windows build step. The main package contains only main.go, so the compiled output is unchanged; only the build target notation and the flag differ.

Validation

From a clean clone at the same commit, built both ways:

build target vcs.revision
main.go (current) absent
. (this change) 4b0e9f9b6032fa9f4ddd144f6f042ab73792d371

Also confirmed vcs.modified=false under release conditions — the frontend bundle lands in the gitignored internal/web/dist/, so the tree stays clean and the stamp is trustworthy rather than permanently marked dirty.

Risk

Low. No flag that affects code generation changes, and -buildvcs=true cannot fail the build here: the release job checks out a git repository, which is the only condition it requires.

Worth knowing: this does not extend to the Docker image, since .dockerignore excludes .git and Go silently omits the stamp outside a repository. Making container builds traceable is a separate change and is deliberately not attempted here.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6223 **Author:** [@n0ctal](https://github.com/n0ctal) **Created:** 8/16/2026 **Status:** ✅ Merged **Merged:** 8/18/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `upstream-stamp-release-revision` --- ### 📝 Commits (2) - [`32b9768`](https://github.com/MHSanaei/3x-ui/commit/32b9768330bb9084aa8c847f88c33893adbcad3b) ci(release): stamp released binaries with their source revision - [`e5f2f5c`](https://github.com/MHSanaei/3x-ui/commit/e5f2f5c78eebc14f2fb2f48307d3fcce9d0e31cc) ci(release): give the Windows job the git it needs to stamp ### 📊 Changes **1 file changed** (+3 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/release.yml` (+3 -2) </details> ### 📄 Description ## Summary The release workflow builds `main.go`. Go treats a file argument as a file list, records the package path as `command-line-arguments`, and skips VCS stamping entirely — so published binaries carry no revision. Building the package instead (`.`) with `-buildvcs=true` produces the same binary and adds `vcs.revision` / `vcs.time`. ## Why Right now there is no way to map a released binary back to a commit. When a user reports a bug against "the latest release", the version string is all there is, and it does not distinguish rebuilds or tag moves. `go version -m` is the standard place to look and it currently answers nothing: ``` $ go version -m xui-release xui-release: go1.26.6 path command-line-arguments ``` ## Scope Two lines in `.github/workflows/release.yml` — the Linux and the Windows build step. The `main` package contains only `main.go`, so the compiled output is unchanged; only the build target notation and the flag differ. ## Validation From a clean clone at the same commit, built both ways: | build target | `vcs.revision` | |---|---| | `main.go` (current) | absent | | `.` (this change) | `4b0e9f9b6032fa9f4ddd144f6f042ab73792d371` | Also confirmed `vcs.modified=false` under release conditions — the frontend bundle lands in the gitignored `internal/web/dist/`, so the tree stays clean and the stamp is trustworthy rather than permanently marked dirty. ## Risk Low. No flag that affects code generation changes, and `-buildvcs=true` cannot fail the build here: the release job checks out a git repository, which is the only condition it requires. Worth knowing: this does not extend to the Docker image, since `.dockerignore` excludes `.git` and Go silently omits the stamp outside a repository. Making container builds traceable is a separate change and is deliberately not attempted here. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:06:57 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#6185
No description provided.