Skip to content

Commit 1ffd470

Browse files
author
derklaro
committed
properly set crate version during build
1 parent e3bc669 commit 1ffd470

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,19 @@ jobs:
7575
toolchain: stable
7676
targets: ${{ matrix.platform.target }}
7777

78+
- name: Install Cargo Edit
79+
run: cargo install cargo-edit
80+
81+
- name: Set Crate Version
82+
run: cargo set-version ${{ steps.get_release_version.outputs.version }}
83+
7884
- name: Initialize Rust caching
7985
uses: Swatinem/rust-cache@v2
8086
with:
8187
key: ${{ matrix.platform.target }}
8288

8389
- name: Compile Binary
8490
uses: clechasseur/rs-cargo@v2
85-
env:
86-
BUILD_VERSION: ${{ steps.get_release_version.outputs.version }}
8791
with:
8892
command: build
8993
use-cross: true

openmetrics_udpserver/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub static METRIC_COUNTER_REQUESTS: Lazy<Counter<u64>> = Lazy::new(Default::defa
2323
pub static METRIC_COUNTER_ERRORS: Lazy<Counter<u64>> = Lazy::new(Default::default);
2424
pub static METRIC_COUNTER_UDP_PACKETS: Lazy<Counter<u64>> = Lazy::new(Default::default);
2525

26-
const VERSION: Option<&str> = option_env!("BUILD_VERSION");
26+
const VERSION: Option<&str> = option_env!("CARGO_PKG_VERSION");
2727

2828
#[tokio::main]
2929
async fn main() -> anyhow::Result<(), anyhow::Error> {

0 commit comments

Comments
 (0)