feat: add git author for build info

This commit is contained in:
lilong.129
2025-03-31 11:03:30 +08:00
parent 561560accb
commit 284efabbd2
3 changed files with 5 additions and 3 deletions

View File

@@ -21,6 +21,7 @@ build: ## build hrp cli tool
-s -w \
-X 'github.com/httprunner/httprunner/v5/internal/version.GitCommit=$(shell git rev-parse HEAD)' \
-X 'github.com/httprunner/httprunner/v5/internal/version.GitBranch=$(shell git rev-parse --abbrev-ref HEAD)' \
-X 'github.com/httprunner/httprunner/v5/internal/version.GitAuthor=$(shell git log -1 --pretty=format:%an)' \
-X 'github.com/httprunner/httprunner/v5/internal/version.BuildTime=$(shell date "+%y%m%d%H%M")'" \
-o output/hrp ./cmd/cli
./output/hrp -v

View File

@@ -1 +1 @@
v5.0.0-beta-2503311054
v5.0.0-beta-2503311103

View File

@@ -19,6 +19,7 @@ var (
GitCommit = "unknown"
GitBranch = "unknown"
BuildTime = "unknown"
GitAuthor = "unknown"
)
func GetVersionInfo() string {
@@ -26,6 +27,6 @@ func GetVersionInfo() string {
if len(commitID) > 8 {
commitID = commitID[:8]
}
return fmt.Sprintf("%s (branch=%s, commit=%s, build=%s)",
VERSION, GitBranch, commitID, BuildTime)
return fmt.Sprintf("%s (branch=%s, commit=%s, author=%s, build=%s)",
VERSION, GitBranch, commitID, GitAuthor, BuildTime)
}