Skip to content

Commit

Permalink
Generate manpages in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
dani-garcia committed Apr 4, 2024
1 parent 20c28e3 commit 5e29768
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/build-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -435,3 +435,38 @@ jobs:
name: THIRDPARTY.html
path: ./crates/bws/THIRDPARTY.html
if-no-files-found: error

manpages:
name: Generate manpages
runs-on: ubuntu-22.04
needs:
- setup
steps:
- name: Checkout repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Install jq
run: sudo apt-get install -y jq

- name: Install rust
uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 # stable
with:
toolchain: stable

- name: Cache cargo registry
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
key: cargo-cli-manpage

- name: Generate manpages
run: |
cargo check -p bws --message-format json > build.json
OUT_DIR=$(jq -r --slurp '.[] | select (.reason == "build-script-executed") | select(.package_id|contains("crates/bws")) .out_dir' build.json)
mv $OUT_DIR/manpages .
- name: Upload artifact
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: manpages
path: ./manpages/*
if-no-files-found: error
2 changes: 0 additions & 2 deletions crates/bws/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,5 @@ fn main() -> Result<(), std::io::Error> {
let cmd = <Cli as clap::CommandFactory>::command();
clap_mangen::generate_to(cmd, &path)?;

println!("cargo:warning=man files generated: {path:?}");

Ok(())
}

0 comments on commit 5e29768

Please sign in to comment.