fix(ci): 修复版本注入和CI触发配置

- goreleaser ldflags 指向正确的包路径 common.version/commit/date
- version 改为 var 支持 ldflags 注入,banner 显示 commit 和构建日期
- test-build 触发分支增加 dev-* 通配
This commit is contained in:
ZacharyZcR
2026-04-25 08:19:08 +08:00
parent 25e66a68a0
commit 1144ee8b21
4 changed files with 16 additions and 7 deletions
+6 -3
View File
@@ -69,12 +69,15 @@ func Banner() {
fmt.Println(bottomBorder)
// 打印版本信息
versionStr := fmt.Sprintf(" Fscan %s (%s %s)", version, commit, date)
if commit == "unknown" {
versionStr = fmt.Sprintf(" Fscan %s", version)
}
if flagVars.NoColor {
// 无色彩模式下使用普通文本
fmt.Printf(" Fscan Version: %s\n\n", version)
fmt.Printf("%s\n\n", versionStr)
} else {
c := color.New(colors[1])
_, _ = c.Printf(" Fscan Version: %s\n\n", version)
_, _ = c.Printf("%s\n\n", versionStr)
}
}
+6 -1
View File
@@ -60,7 +60,12 @@ const (
LogLevelBaseInfoSuccess = "base,info,success"
)
const version = "2.1.1"
// 版本信息,通过 ldflags 注入
var (
version = "2.1.1"
commit = "unknown"
date = "unknown"
)
// 运行时数据已迁移到Config对象中,使用GetGlobalConfig()访问