BlueGit

ict rusty-teams

Files

rusty-teams / crates / app-base / src / version.rs

version.rs

version.rs 606 B Download Raw
1use std::sync::OnceLock;
2
3static BUILD_VERSION: OnceLock<&'static str> = OnceLock::new();
4
5pub fn set_build_version(version: &'static str) {
6 let _ = BUILD_VERSION.set(version);
7}
8
9pub fn build_version() -> &'static str {
10 BUILD_VERSION.get().copied().unwrap_or("unknown")
11}
12
13static RELEASE_TAG: OnceLock<&'static str> = OnceLock::new();
14
15pub fn set_release_tag(tag: &'static str) {
16 let _ = RELEASE_TAG.set(tag);
17}
18
19/// Set only in builds of a `v*` tag, so local and deployed dev builds never pull a GitHub release.
20pub fn release_tag() -> Option<&'static str> {
21 RELEASE_TAG.get().copied()
22}