Files
radicle-explorer/crates/radicle-tauri/build.rs
T
Lorenz Leutgeb 8ce7b1a4d5 radicle-tauri/build: Allow Specifying Version via GIT_HEAD
This now allows setting `GIT_HEAD` "from the outside" and will
gracefully fall back to "unknown" in case there's any issue figuring out
what HEAD refers to.
2025-05-08 14:54:41 +02:00

16 lines
435 B
Rust

use std::env;
use std::process::Command;
fn main() {
let head = env::var("GIT_HEAD").unwrap_or_else(|_| {
Command::new("git")
.args(["rev-parse", "--short", "HEAD"])
.output()
.map(|output| String::from_utf8(output.stdout).expect("output from Git is UTF-8"))
.unwrap_or("unknown".into())
});
println!("cargo::rustc-env=GIT_HEAD={head}");
tauri_build::build()
}