feat: versioning SemVer MAJOR.MINOR.PATCH basé sur git describe
CI / lint (push) Failing after 9s
CI / test (push) Has been skipped
CI / build (push) Has been skipped
CI / e2e (push) Has been skipped
CI / security (push) Successful in 13s
Desktop Build / build-windows (push) Has been cancelled
Desktop Build / build-linux (push) Has been cancelled
CI / lint (push) Failing after 9s
CI / test (push) Has been skipped
CI / build (push) Has been skipped
CI / e2e (push) Has been skipped
CI / security (push) Successful in 13s
Desktop Build / build-windows (push) Has been cancelled
Desktop Build / build-linux (push) Has been cancelled
- backend/version.py: get_version() lit git describe --tags (ex: 1.8.0-301-gabc1234) - main.py: FastAPI version = get_version() dynamique - build.rs: injecte GIT_VERSION, GIT_HASH, SEMVER depuis git describe - main.rs: ABOUT_MSG, get_version(), log utilisent GIT_VERSION - Format: MAJOR.MINOR.PATCH[-commits-gHASH] (ex: 1.8.0, 1.8.0-3-gabc1234) - Fallback: VERSION file ou 0.0.0-dev si Git indisponible
This commit is contained in:
+18
-3
@@ -1,6 +1,15 @@
|
||||
fn main() {
|
||||
// Inject Git commit hash as version suffix
|
||||
let git_hash = std::process::Command::new("git")
|
||||
// Get version from git describe (same as backend/version.py)
|
||||
let version = std::process::Command::new("git")
|
||||
.args(["describe", "--tags", "--dirty=-dirty"])
|
||||
.output()
|
||||
.ok()
|
||||
.and_then(|o| String::from_utf8(o.stdout).ok())
|
||||
.map(|s| s.trim().trim_start_matches('v').to_string())
|
||||
.unwrap_or_else(|| "0.0.0-dev".to_string());
|
||||
|
||||
// Extract short hash for display
|
||||
let short_hash = std::process::Command::new("git")
|
||||
.args(["rev-parse", "--short", "HEAD"])
|
||||
.output()
|
||||
.ok()
|
||||
@@ -8,9 +17,15 @@ fn main() {
|
||||
.map(|s| s.trim().to_string())
|
||||
.unwrap_or_else(|| "unknown".to_string());
|
||||
|
||||
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
|
||||
// SemVer base (strip -suffix)
|
||||
let semver_base = version.split('-').next().unwrap_or("0.0.0");
|
||||
|
||||
println!("cargo:rustc-env=GIT_VERSION={}", version);
|
||||
println!("cargo:rustc-env=GIT_HASH={}", short_hash);
|
||||
println!("cargo:rustc-env=SEMVER={}", semver_base);
|
||||
println!("cargo:rerun-if-changed=.git/HEAD");
|
||||
println!("cargo:rerun-if-changed=.git/refs/heads/main");
|
||||
println!("cargo:rerun-if-changed=.git/refs/tags");
|
||||
|
||||
tauri_build::build()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user