toolkit for mdBook [mirror of my GitHub repo] docs.tonywu.dev/mdbookkit/
permalinks rust-analyzer mdbook
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: cargo xtask which-package

Tony Wu e73ec298 db758150

+60 -13
+1
.cargo/config.toml
··· 1 1 [alias] 2 2 bin = ["run", "--quiet", "--package", "cargo-bin", "--"] 3 + xtask = ["run", "--package", "cargo-xtask", "--"]
+5 -12
.github/workflows/bin.yml
··· 41 41 # only linux builds unless release 42 42 release: 43 43 - ${{github.event_name == 'release' || github.event_name == 'workflow_dispatch'}} 44 + 44 45 exclude: 45 46 - release: false 46 47 target: aarch64-apple-darwin ··· 57 58 timeout-minutes: 60 58 59 59 60 steps: 60 - - name: Which package? 61 - run: | 62 - case "${{ github.event.release.tag_name }}" in 63 - mdbook-rustdoc-links*) 64 - echo "mdbook-rustdoc-links=true" >> "$GITHUB_OUTPUT" 65 - ;; 66 - mdbook-permalinks*) 67 - echo "mdbook-permalinks=true" >> "$GITHUB_OUTPUT" 68 - ;; 69 - esac 70 - id: bins 71 - 72 61 - uses: actions/checkout@v4 73 62 - uses: dtolnay/rust-toolchain@stable 74 63 id: rustup ··· 94 83 path: | 95 84 .bin/ 96 85 target/ 86 + 87 + - name: Which package? 88 + run: cargo xtask which-package ${{ github.event.release.tag_name }} 89 + id: bins 97 90 98 91 - name: Build mdbook-rustdoc-links 99 92 uses: taiki-e/upload-rust-binary-action@v1
+1 -1
.vscode/settings.json
··· 7 7 "[markdown]": { 8 8 "editor.defaultFormatter": "esbenp.prettier-vscode" 9 9 }, 10 - "cSpell.words": ["cmark", "mdbookkit", "Minato", "rstest", "unmark"], 10 + "cSpell.words": ["cmark", "mdbookkit", "Minato", "rstest", "unmark", "xtask"], 11 11 "deno.enable": false, 12 12 "editor.codeActionsOnSave": { 13 13 "source.sortImports": "explicit"
+8
Cargo.lock
··· 253 253 ] 254 254 255 255 [[package]] 256 + name = "cargo-xtask" 257 + version = "0.1.0" 258 + dependencies = [ 259 + "anyhow", 260 + "clap", 261 + ] 262 + 263 + [[package]] 256 264 name = "cargo_toml" 257 265 version = "0.22.3" 258 266 source = "registry+https://github.com/rust-lang/crates.io-index"
+14
utils/cargo-xtask/Cargo.toml
··· 1 + [package] 2 + name = "cargo-xtask" 3 + version = "0.1.0" 4 + 5 + authors.workspace = true 6 + edition.workspace = true 7 + license.workspace = true 8 + publish.workspace = true 9 + repository.workspace = true 10 + rust-version.workspace = true 11 + 12 + [dependencies] 13 + anyhow.workspace = true 14 + clap = { workspace = true }
+31
utils/cargo-xtask/src/main.rs
··· 1 + use std::{env, fs, io::Write}; 2 + 3 + use anyhow::{Context, Result}; 4 + 5 + fn main() -> Result<()> { 6 + let output = env::var("GITHUB_OUTPUT").context("missing $GITHUB_OUTPUT")?; 7 + let mut output = fs::OpenOptions::new() 8 + .create(true) 9 + .append(true) 10 + .open(output) 11 + .context("failed to open $GITHUB_OUTPUT")?; 12 + 13 + match clap::Parser::parse() { 14 + Command::WhichPackage { tag_name } => { 15 + for package in ["mdbook-rustdoc-links", "mdbook-permalinks"] { 16 + if (tag_name.as_ref()).is_some_and(|tag| tag.starts_with(package)) 17 + || tag_name.is_none() 18 + { 19 + writeln!(&mut output, "{package}=true")?; 20 + } 21 + } 22 + } 23 + } 24 + 25 + Ok(()) 26 + } 27 + 28 + #[derive(clap::Parser, Debug)] 29 + enum Command { 30 + WhichPackage { tag_name: Option<String> }, 31 + }