Skip to content

Commit a789037

Browse files
committed
automatically set release version based on tag
1 parent b2eda4f commit a789037

5 files changed

Lines changed: 10 additions & 10 deletions

File tree

.github/workflows/release.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ env:
1414
jobs:
1515
release:
1616
name: Release - ${{ matrix.platform.os_name }}
17+
env:
18+
COMAN_RELEASE_VERSION: ${{ github.event.release.tag_name }}
1719
strategy:
1820
matrix:
1921
platform:
@@ -53,6 +55,8 @@ jobs:
5355
steps:
5456
- name: Checkout
5557
uses: actions/checkout@v5
58+
- name: Strip version leading v
59+
run: echo "COMAN_RELEASE_VERSION=${COMAN_RELEASE_VERSION##v}" >> $GITHUB_ENV
5660
- name: Install toolchain
5761
uses: dtolnay/rust-toolchain@stable
5862
with:

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coman/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[package]
22
name = "coman"
3-
version = "0.8.9"
43
edition = "2024"
54
description = "Compute Manager for managing HPC compute"
65
authors = ["Ralf Grubenmann <ralf.grubenmann@sdsc.ethz.ch>"]

coman/build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ use anyhow::Result;
22
use vergen_gix::{BuildBuilder, CargoBuilder, Emitter, GixBuilder};
33

44
fn main() -> Result<()> {
5+
if let Ok(val) = std::env::var("COMAN_RELEASE_VERSION") {
6+
println!("cargo:rustc-env=CARGO_PKG_VERSION={}", val);
7+
}
8+
println!("cargo:rerun-if-env-changed=COMAN_RELEASE_VERSION");
59
let build = BuildBuilder::all_build()?;
610
let gix = GixBuilder::all_git()?;
711
let cargo = CargoBuilder::all_cargo()?;

coman/src/cli/app.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -485,14 +485,7 @@ pub enum CscsSystemCommands {
485485

486486
pub const COMAN_VERSION: &str = env!("CARGO_PKG_VERSION");
487487

488-
const VERSION_MESSAGE: &str = concat!(
489-
env!("CARGO_PKG_VERSION"),
490-
"-",
491-
env!("VERGEN_GIT_DESCRIBE"),
492-
" (",
493-
env!("VERGEN_BUILD_DATE"),
494-
")"
495-
);
488+
const VERSION_MESSAGE: &str = concat!(env!("CARGO_PKG_VERSION"), " (", env!("VERGEN_BUILD_DATE"), ")");
496489

497490
pub fn version() -> String {
498491
// let current_exe_path = PathBuf::from(clap::crate_name!()).display().to_string();

0 commit comments

Comments
 (0)