Set GIT_REV from build script
Some checks failed
Push Workflows / rustfmt (push) Failing after 5s
Push Workflows / tailwind-build (push) Successful in 5s
Push Workflows / test (push) Successful in 28s
Push Workflows / clippy (push) Successful in 23s
Push Workflows / docs (push) Successful in 27s
Push Workflows / build (push) Has been cancelled
Push Workflows / nix-build (push) Has been cancelled
Some checks failed
Push Workflows / rustfmt (push) Failing after 5s
Push Workflows / tailwind-build (push) Successful in 5s
Push Workflows / test (push) Successful in 28s
Push Workflows / clippy (push) Successful in 23s
Push Workflows / docs (push) Successful in 27s
Push Workflows / build (push) Has been cancelled
Push Workflows / nix-build (push) Has been cancelled
This commit is contained in:
16
src/build.rs
16
src/build.rs
@@ -1,3 +1,19 @@
|
|||||||
|
use std::process::Command;
|
||||||
|
use std::env;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("cargo:rerun-if-changed=migrations");
|
println!("cargo:rerun-if-changed=migrations");
|
||||||
|
println!("cargo:rerun-if-changed=.git");
|
||||||
|
|
||||||
|
if env::var("GIT_REV").is_err() {
|
||||||
|
let git_rev: String = Command::new("git")
|
||||||
|
.args(["rev-parse", "HEAD"])
|
||||||
|
.output()
|
||||||
|
.expect("Failed to run git rev-parse")
|
||||||
|
.stdout
|
||||||
|
.try_into()
|
||||||
|
.expect("Failed to parse output from git");
|
||||||
|
|
||||||
|
println!("cargo:rustc-env=GIT_REV={git_rev}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user