docker, ci: fix --version output

When building the docker image manually, MINEDMAP_VERSION needs to be
set explicitly to get a proper version string.
This commit is contained in:
Matthias Schiffer 2025-02-22 11:06:46 +01:00
parent 282f62fc30
commit 8cb1eee60b
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
3 changed files with 26 additions and 6 deletions

View file

@ -33,17 +33,23 @@ use tracing::{info, warn};
use self::entity_collector::EntityCollector;
/// MinedMap version number
const VERSION: &str = git_version!(
args = ["--abbrev=7", "--match=v*", "--dirty=-modified"],
cargo_prefix = "v",
);
/// Returns the MinedMap version number
fn version() -> &'static str {
option_env!("MINEDMAP_VERSION").unwrap_or(
git_version!(
args = ["--abbrev=7", "--match=v*", "--dirty=-modified"],
cargo_prefix = "v",
)
.strip_prefix("v")
.unwrap(),
)
}
/// Command line arguments for minedmap CLI
#[derive(Debug, Parser)]
#[command(
about,
version = VERSION.strip_prefix("v").unwrap(),
version = version(),
max_term_width = 100,
)]
pub struct Args {