write website

This commit is contained in:
nora 2023-08-31 20:46:44 +02:00
parent 24abf6d98c
commit 7ff9a67148
15 changed files with 1580 additions and 38 deletions

35
build.rs Normal file
View file

@ -0,0 +1,35 @@
fn main() {
// Always rerun.
let version = if let Ok(commit) = try_get_commit() {
match has_no_changes() {
Ok(true) => commit,
Ok(false) => format!("{commit} (*)"),
Err(_) => format!("{commit} (?)"),
}
} else {
"unknown".into()
};
println!("cargo:rustc-env=GIT_COMMIT={version}");
}
fn try_get_commit() -> eyre::Result<String> {
let stdout = std::process::Command::new("git")
.arg("rev-parse")
.arg("HEAD")
.output()?
.stdout;
let stdout = String::from_utf8(stdout)?;
Ok(stdout.trim().to_owned())
}
fn has_no_changes() -> eyre::Result<bool> {
Ok(std::process::Command::new("git")
.args(["diff", "--no-ext-diff", "--quiet", "--exit-code"])
.output()?
.status
.success())
}