Spiegel von
https://github.com/dani-garcia/vaultwarden.git
synchronisiert 2025-03-13 16:57:01 +01:00
Last tag is now optional. Timestamp is added to version string.
Dieser Commit ist enthalten in:
Ursprung
9366e31452
Commit
7d7da9212e
1 geänderte Dateien mit 19 neuen und 4 gelöschten Zeilen
23
build.rs
23
build.rs
|
@ -57,8 +57,10 @@ fn version_from_git_info() -> Result<String, std::io::Error> {
|
||||||
|
|
||||||
// The last available tag, equal to exact_tag when
|
// The last available tag, equal to exact_tag when
|
||||||
// the current commit is tagged
|
// the current commit is tagged
|
||||||
let last_tag = run(&["git", "describe", "--abbrev=0", "--tags"])?;
|
let last_tag_maybe = run(&["git", "describe", "--abbrev=0", "--tags"]).ok();
|
||||||
println!("cargo:rustc-env=GIT_LAST_TAG={last_tag}");
|
if let Some(ref last_tag) = last_tag_maybe {
|
||||||
|
println!("cargo:rustc-env=GIT_LAST_TAG={last_tag}");
|
||||||
|
}
|
||||||
|
|
||||||
// The current branch name
|
// The current branch name
|
||||||
let branch = run(&["git", "rev-parse", "--abbrev-ref", "HEAD"])?;
|
let branch = run(&["git", "rev-parse", "--abbrev-ref", "HEAD"])?;
|
||||||
|
@ -69,12 +71,25 @@ fn version_from_git_info() -> Result<String, std::io::Error> {
|
||||||
let rev_short = rev.get(..8).unwrap_or_default();
|
let rev_short = rev.get(..8).unwrap_or_default();
|
||||||
println!("cargo:rustc-env=GIT_REV={rev_short}");
|
println!("cargo:rustc-env=GIT_REV={rev_short}");
|
||||||
|
|
||||||
|
// The current git commit time
|
||||||
|
let commit_time = run(&["git", "log", "-1", "--format=%cd", "--date=format:%Y-%m-%d %H:%M:%S"])?;
|
||||||
|
|
||||||
// Combined version
|
// Combined version
|
||||||
if let Some(exact) = exact_tag {
|
if let Some(exact) = exact_tag {
|
||||||
Ok(exact)
|
Ok(exact)
|
||||||
} else if &branch != "main" && &branch != "master" {
|
} else if &branch != "main" && &branch != "master" {
|
||||||
Ok(format!("{last_tag}-{rev_short} ({branch})"))
|
if let Some(ref last_tag) = last_tag_maybe {
|
||||||
|
Ok(format!("{last_tag}-{rev_short} ({branch}) {commit_time}"))
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Ok(format!("{rev_short} ({branch}) {commit_time}"))
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Ok(format!("{last_tag}-{rev_short}"))
|
if let Some(ref last_tag) = last_tag_maybe {
|
||||||
|
Ok(format!("{last_tag}-{rev_short} {commit_time}"))
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Ok(format!("main-{rev_short} {commit_time}"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Laden …
Tabelle hinzufügen
In neuem Issue referenzieren