| 1 | use std::sync::OnceLock; |
| 2 | |
| 3 | static BUILD_VERSION: OnceLock<&'static str> = OnceLock::new(); |
| 4 | |
| 5 | pub fn set_build_version(version: &'static str) { |
| 6 | let _ = BUILD_VERSION.set(version); |
| 7 | } |
| 8 | |
| 9 | pub fn build_version() -> &'static str { |
| 10 | BUILD_VERSION.get().copied().unwrap_or("unknown") |
| 11 | } |
| 12 | |
| 13 | static RELEASE_TAG: OnceLock<&'static str> = OnceLock::new(); |
| 14 | |
| 15 | pub 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. |
| 20 | pub fn release_tag() -> Option<&'static str> { |
| 21 | RELEASE_TAG.get().copied() |
| 22 | } |