2024-02-28 01:34:52 +08:00
|
|
|
fn main() {
|
|
|
|
if let Err(err) = emit_git_variables() {
|
|
|
|
println!("cargo:warning=vergen: {}", err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn emit_git_variables() -> anyhow::Result<()> {
|
|
|
|
// Note: any code that needs VERGEN_ environment variables should take care to define them manually in the Dockerfile and pass them
|
|
|
|
// in the corresponding GitHub workflow (publish_docker.yml).
|
|
|
|
// This is due to the Dockerfile building the binary outside of the git directory.
|
2024-05-23 22:38:44 +08:00
|
|
|
let mut builder = vergen_gitcl::GitclBuilder::default();
|
2024-02-28 01:34:52 +08:00
|
|
|
|
|
|
|
builder.branch(true);
|
|
|
|
builder.commit_timestamp(true);
|
|
|
|
builder.commit_message(true);
|
|
|
|
builder.describe(true, true, None);
|
|
|
|
builder.sha(false);
|
|
|
|
|
2024-05-23 22:38:44 +08:00
|
|
|
let gitcl = builder.build()?;
|
|
|
|
vergen_gitcl::Emitter::default().fail_on_error().add_instructions(&gitcl)?.emit()
|
2024-02-28 01:34:52 +08:00
|
|
|
}
|