Allow MEILI_NO_VERGEN env var to skip vergen

This commit is contained in:
Louis Dureuil 2024-07-18 17:28:01 +02:00
parent 6e9d0de8b7
commit c6b33fd407
No known key found for this signature in database
2 changed files with 11 additions and 0 deletions

View file

@ -5,6 +5,13 @@ fn main() {
}
fn emit_git_variables() -> anyhow::Result<()> {
println!("cargo::rerun-if-env-changed=MEILI_NO_VERGEN");
let has_vergen =
!matches!(std::env::var_os("MEILI_NO_VERGEN"), Some(x) if x != "false" && x != "0");
anyhow::ensure!(has_vergen, "disabled via `MEILI_NO_VERGEN`");
// 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.