Add versioning support to build artifacts and log outputs

- Introduced `Version` variable, set during build via `-ldflags`, to embed application version.
- Updated Dockerfile to accept `APP_VERSION` argument for version injection during build.
- Modified `.goreleaser.yml` to pass GitHub release tag as version via `ldflags`.
- Added version logging in the application startup.
This commit is contained in:
Luis Pater
2025-09-05 22:53:49 +08:00
parent 4f18809500
commit b05d00ede9
4 changed files with 11 additions and 1 deletions

View File

@@ -17,6 +17,8 @@ import (
log "github.com/sirupsen/logrus"
)
var Version = "dev"
// LogFormatter defines a custom log format for logrus.
// This formatter adds timestamp, log level, and source location information
// to each log entry for better debugging and monitoring.
@@ -58,6 +60,8 @@ func init() {
// It parses command-line flags, loads configuration, and starts the appropriate
// service based on the provided flags (login, codex-login, or server mode).
func main() {
log.Infof("CLIProxyAPI Version: %v", Version)
// Command-line flags to control the application's behavior.
var login bool
var codexLogin bool