Skip to content

Commit

Permalink
Merge pull request #12 from magnusuMET/release_workflow
Browse files Browse the repository at this point in the history
Release workflow
  • Loading branch information
magnusuMET authored Aug 14, 2024
2 parents 8c8241f + d6a6f62 commit 4d6555f
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 14 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: Release

on:
push:
tags:
- "hdf5-src-v*"
- "hdf5-sys-v*"
- "hdf5-derive-v*"
- "hdf5-types-v*"
- "hdf5-v*"

env:
CARGO_TERM_COLOR: always

jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Install libhdf5
run: sudo apt-get update && sudo apt-get install libhdf5-dev
- name: Install rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Publish hdf5-src
if: "${{ startsWith(github.ref_name, 'hdf5-src-v') }}"
run: cargo publish --package hdf5-metno-src --token "${{ secrets.CRATES_IO_TOKEN }}"
- name: Publish hdf5-sys
if: "${{ startsWith(github.ref_name, 'hdf5-sys-v') }}"
run: cargo publish --package hdf5-metno-sys --token "${{ secrets.CRATES_IO_TOKEN }}"
- name: Publish hdf5-derive
if: "${{ startsWith(github.ref_name, 'hdf5-metno-derive-v') }}"
run: cargo publish --package hdf5-metno-derive --token "${{ secrets.CRATES_IO_TOKEN }}"
- name: Publish hdf5-types
if: "${{ startsWith(github.ref_name, 'hdf5-metno-types-v') }}"
run: cargo publish --package hdf5-metno-types --token "${{ secrets.CRATES_IO_TOKEN }}"
- name: Publish hdf5
if: "${{ startsWith(github.ref_name, 'hdf5-v') }}"
run: cargo publish --package hdf5-metno --token "${{ secrets.CRATES_IO_TOKEN }}"
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ members = ["hdf5", "hdf5-types", "hdf5-derive", "hdf5-sys", "hdf5-src"]
default-members = ["hdf5", "hdf5-types", "hdf5-derive", "hdf5-sys"]

[workspace.package]
version = "0.9.2" # !V
rust-version = "1.80.0"
authors = [
"Ivan Smirnov <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion hdf5-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "hdf5-metno-derive"
description = "Derive macro for HDF5 structs and enums."
categories = ["development-tools::procedural-macro-helpers"]
readme = "README.md"
version.workspace = true
version = "0.9.0" # !V
rust-version.workspace = true
authors.workspace = true
keywords.workspace = true
Expand Down
18 changes: 9 additions & 9 deletions hdf5-src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ fn configure_cmake_cross_run_advanced_cache_vars(cfg: &mut cmake::Config) {
"H5_NO_ALIGNMENT_RESTRICTIONS_RUN",
"H5_NO_ALIGNMENT_RESTRICTIONS_RUN__TRYRUN_OUTPUT",
] {
println!("cargo:rerun-if-env-changed={option}");
println!("cargo::rerun-if-env-changed={option}");
let value = env::var(option).unwrap_or_else(|_| "OFF".to_string());
cfg.define(option, value);
}
}

fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo::rerun-if-changed=build.rs");
let mut cfg = cmake::Config::new("ext/hdf5");

// only build the static c library, disable everything else
Expand Down Expand Up @@ -70,8 +70,8 @@ fn main() {
cfg.define("HDF5_ENABLE_Z_LIB_SUPPORT", "ON")
.define("H5_ZLIB_HEADER", &zlib_header)
.define("ZLIB_STATIC_LIBRARY", zlib_lib);
println!("cargo:zlib_header={}", zlib_header.to_str().unwrap());
println!("cargo:zlib={}", zlib_lib);
println!("cargo::metadata=zlib_header={}", zlib_header.to_str().unwrap());
println!("cargo::metadata=zlib={}", zlib_lib);
} else {
cfg.define("HDF5_ENABLE_Z_LIB_SUPPORT", "OFF");
}
Expand All @@ -83,7 +83,7 @@ fn main() {
if feature_enabled("THREADSAFE") {
cfg.define("HDF5_ENABLE_THREADSAFE", "ON");
if feature_enabled("HL") {
println!("cargo:warning=Unsupported HDF5 options: hl with threadsafe.");
println!("cargo::warning=Unsupported HDF5 options: hl with threadsafe.");
cfg.define("ALLOW_UNSUPPORTED", "ON");
}
}
Expand All @@ -100,7 +100,7 @@ fn main() {
hdf5_hl_lib.push_str(debug_postfix);
}
}
println!("cargo:hl_library={}", hdf5_hl_lib);
println!("cargo::metadata=hl_library={}", hdf5_hl_lib);
}

if cfg!(unix) && targeting_windows {
Expand All @@ -112,10 +112,10 @@ fn main() {

configure_cmake_cross_run_advanced_cache_vars(&mut cfg);
let dst = cfg.build();
println!("cargo:root={}", dst.display());
println!("cargo::metadata=root={}", dst.display());

let hdf5_incdir = format!("{}/include", dst.display());
println!("cargo:include={}", hdf5_incdir);
println!("cargo::metadata=include={}", hdf5_incdir);

let mut hdf5_lib = if cfg!(target_env = "msvc") { "libhdf5" } else { "hdf5" }.to_owned();
if let Ok(opt_level) = env::var("OPT_LEVEL") {
Expand All @@ -124,5 +124,5 @@ fn main() {
}
}

println!("cargo:library={}", hdf5_lib);
println!("cargo::metadata=library={}", hdf5_lib);
}
2 changes: 1 addition & 1 deletion hdf5-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = "Native bindings to the HDF5 library."
links = "hdf5"
readme = "README.md"
categories = ["development-tools::ffi", "filesystem", "science"]
version.workspace = true
version = "0.9.1" # !V
rust-version.workspace = true
authors.workspace = true
keywords.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion hdf5-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description = "Native Rust equivalents of HDF5 types."
readme = "README.md"
build = "build.rs"
categories = ["encoding"]
version.workspace = true
version = "0.9.0" # !V
rust-version.workspace = true
authors.workspace = true
keywords.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion hdf5/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ readme = "../README.md"
description = "Thread-safe Rust bindings for the HDF5 library."
build = "build.rs"
categories = ["science", "filesystem"]
version.workspace = true
version = "0.9.2" # !V
rust-version.workspace = true
authors.workspace = true
keywords.workspace = true
Expand Down

0 comments on commit 4d6555f

Please sign in to comment.