Added git hash used for the build in the footer
parent
67027a3282
commit
791b55b367
|
|
@ -0,0 +1,22 @@
|
||||||
|
use std::{env, fs, path::Path};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let out_dir = env::var_os("OUT_DIR").unwrap();
|
||||||
|
|
||||||
|
let path = Path::new(&out_dir).join("git_hash.rs");
|
||||||
|
|
||||||
|
let git_output = std::process::Command::new("git")
|
||||||
|
.args(["rev-parse", "--short", "HEAD"])
|
||||||
|
.output()
|
||||||
|
.unwrap()
|
||||||
|
.stdout;
|
||||||
|
|
||||||
|
let last_hash = String::from_utf8(git_output).unwrap();
|
||||||
|
let last_hash = last_hash.trim();
|
||||||
|
|
||||||
|
fs::write(
|
||||||
|
&path,
|
||||||
|
format!("pub const GIT_HASH: &str = \"{last_hash}\";"),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
2
justfile
2
justfile
|
|
@ -2,7 +2,7 @@ set export
|
||||||
set quiet
|
set quiet
|
||||||
set dotenv-load
|
set dotenv-load
|
||||||
|
|
||||||
#[arg("assets", long="assets")]
|
[arg("assets", long="assets")]
|
||||||
build assets="false":
|
build assets="false":
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
mkdir -p ./out
|
mkdir -p ./out
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ use tracing_subscriber::EnvFilter;
|
||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
|
include!(concat!(env!("OUT_DIR"), "/git_hash.rs"));
|
||||||
|
|
||||||
#[cfg(feature = "bbs")]
|
#[cfg(feature = "bbs")]
|
||||||
mod bbs;
|
mod bbs;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
<body>
|
<body>
|
||||||
<div id="content">{% block content %}{% endblock %}</div>
|
<div id="content">{% block content %}{% endblock %}</div>
|
||||||
<footer>
|
<footer>
|
||||||
<p>v{{ crate::VERSION }}</p>
|
<p>v{{ crate::VERSION +}} - {{+ crate::GIT_HASH }}</p>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue