Files
momentry_core/build.rs
Warren 576f58df71 feat: add build version with timestamp
- Add build.rs to generate BUILD_VERSION at compile time
- Update CLI to show full version: '0.1.0 (build: 2026-03-31 11:21:37)'
- Update health endpoints to return build version
- Add chrono as build dependency
2026-03-31 11:30:50 +08:00

20 lines
614 B
Rust

use chrono::Local;
use std::env;
fn main() {
let now = Local::now();
let build_time = now.format("%Y-%m-%d %H:%M:%S").to_string();
// Get version from Cargo.toml
let version = env!("CARGO_PKG_VERSION");
let full_version = format!("{} (build: {})", version, build_time);
// Set build-time environment variables
println!("cargo:rustc-env=BUILD_VERSION={}", full_version);
println!("cargo:rustc-env=BUILD_TIME={}", build_time);
println!("cargo:rustc-env=VERSION={}", version);
// Also print for debugging
println!("cargo:warning=Building version: {}", full_version);
}