diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-02 15:35:27 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-02 15:35:27 +0000 |
| commit | 347f17f0f9e3bc791d1fd699467da9fef4dab8ff (patch) | |
| tree | 7734eae9dd006ff8dac352f1caf5c9225a913d63 /build.rs | |
| parent | 599d032ff8bbb529575067c193ac498cac590de5 (diff) | |
landing page add commit hash to version and add curation
Diffstat (limited to 'build.rs')
| -rw-r--r-- | build.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..e7d9cba --- /dev/null +++ b/build.rs | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | use std::process::Command; | ||
| 2 | |||
| 3 | fn main() { | ||
| 4 | // Get the short git commit hash | ||
| 5 | let output = Command::new("git") | ||
| 6 | .args(["rev-parse", "--short", "HEAD"]) | ||
| 7 | .output(); | ||
| 8 | |||
| 9 | if let Ok(output) = output { | ||
| 10 | if output.status.success() { | ||
| 11 | let commit = String::from_utf8_lossy(&output.stdout); | ||
| 12 | let commit = commit.trim(); | ||
| 13 | println!("cargo:rustc-env=GIT_COMMIT_SHORT={}", commit); | ||
| 14 | } | ||
| 15 | } | ||
| 16 | |||
| 17 | // Re-run if HEAD changes (new commits) | ||
| 18 | println!("cargo:rerun-if-changed=.git/HEAD"); | ||
| 19 | println!("cargo:rerun-if-changed=.git/refs/heads/"); | ||
| 20 | } \ No newline at end of file | ||