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(ci): setup release-plz and pages

+257 -45
+82 -36
.github/workflows/ci.yml
··· 6 6 - main 7 7 8 8 pull_request: 9 + branches: 10 + - main 9 11 10 12 schedule: 11 - - cron: "27 0 * * *" 13 + - cron: "27 0 * * *" # nightly test for RA 12 14 13 15 env: 14 16 CARGO_TERM_COLOR: always 15 17 16 18 jobs: 17 - build_and_test: 18 - name: build and test 19 + test: 20 + name: Test 19 21 20 22 runs-on: ubuntu-latest 21 23 strategy: 22 24 matrix: 23 25 toolchain: 24 - - "stable" 26 + - stable 27 + 28 + permissions: 29 + contents: read 30 + actions: write # evict cache 25 31 26 32 steps: 27 33 - uses: actions/checkout@v4 34 + with: 35 + fetch-depth: 0 28 36 29 37 - uses: dtolnay/rust-toolchain@master 30 38 with: 31 39 toolchain: ${{ matrix.toolchain }} 32 40 33 - - run: echo "CARGO_VERSION=$(cargo --version)" >> "$GITHUB_OUTPUT" 34 - name: get cargo version 35 - id: cargo-version 41 + - name: Get cache key 42 + run: | 43 + CARGO_VERSION=$(cargo --version) 44 + echo "CACHE_KEY=${{runner.os}}-${{runner.arch}}-$CARGO_VERSION-${{hashFiles('**/Cargo.toml')}}-${{hashFiles('**/Cargo.lock')}}-${{github.workflow}}-${{github.job}}" >> "$GITHUB_OUTPUT" 45 + { 46 + echo "CACHE_KEY_RESTORE<<EOF" 47 + echo "${{runner.os}}-${{runner.arch}}-$CARGO_VERSION-${{hashFiles('**/Cargo.toml')}}-${{hashFiles('**/Cargo.lock')}}-" 48 + echo "${{runner.os}}-${{runner.arch}}-$CARGO_VERSION-${{hashFiles('**/Cargo.toml')}}-" 49 + echo "${{runner.os}}-${{runner.arch}}-$CARGO_VERSION-" 50 + echo "EOF" 51 + } >> "$GITHUB_OUTPUT" 52 + id: cache-key 36 53 37 54 - uses: actions/cache/restore@v4 38 55 with: 39 56 path: | 40 57 target/ 41 - key: | 42 - ${{runner.os}}-${{steps.cargo-version.outputs.CARGO_VERSION}}-${{hashFiles('**/Cargo.toml')}}-${{hashFiles('**/Cargo.lock')}}-${{github.workflow}}-${{github.job}} 43 - restore-keys: | 44 - ${{runner.os}}-${{steps.cargo-version.outputs.CARGO_VERSION}}-${{hashFiles('**/Cargo.toml')}}-${{hashFiles('**/Cargo.lock')}}- 45 - ${{runner.os}}-${{steps.cargo-version.outputs.CARGO_VERSION}}-${{hashFiles('**/Cargo.toml')}}- 46 - ${{runner.os}}-${{steps.cargo-version.outputs.CARGO_VERSION}}- 58 + key: ${{ steps.cache-key.outputs.CACHE_KEY }} 59 + restore-keys: ${{ steps.cache-key.outputs.CACHE_KEY_RESTORE }} 60 + id: cache-restore 61 + 62 + - name: Prepare rust-analyzer 63 + run: cargo run --package util-rust-analyzer -- download 47 64 48 - - run: cargo run --package util-rust-analyzer -- download 49 65 - run: cargo test --release --all-features 50 66 env: 51 67 RUST_LOG: info 52 68 53 - - run: cargo build --release --features rustdoc-link 54 - - run: cargo build --release --features lib-rustdoc-link,common-logger 55 - - run: cargo build --release --features lib-rustdoc-link 56 - 57 - - run: cargo build --release --features link-forever 58 - - run: cargo build --release --features lib-link-forever,common-logger 59 - - run: cargo build --release --features lib-link-forever 69 + - name: Evict cache 70 + run: gh cache delete '${{ steps.cache-key.outputs.CACHE_KEY }}' 71 + if: ${{ steps.cache-restore.outputs.cache-hit }} 72 + env: 73 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 60 74 61 75 - uses: actions/cache/save@v4 62 76 if: always() 63 77 with: 64 78 path: | 65 79 target/ 66 - key: | 67 - ${{runner.os}}-${{steps.cargo-version.outputs.CARGO_VERSION}}-${{hashFiles('**/Cargo.toml')}}-${{hashFiles('**/Cargo.lock')}}-${{github.workflow}}-${{github.job}} 80 + key: ${{ steps.cache-key.outputs.CACHE_KEY }} 68 81 69 - rustdoc_link_ra_test: 70 - name: rustdoc-link RA test 82 + outputs: 83 + CACHE_KEY: ${{ steps.cache-key.outputs.CACHE_KEY }} 84 + CACHE_KEY_RESTORE: ${{ steps.cache-key.outputs.CACHE_KEY_RESTORE }} 85 + 86 + build_features: 87 + name: Build 88 + runs-on: ubuntu-latest 71 89 72 90 needs: 73 - - build_and_test 91 + - test 92 + 93 + strategy: 94 + matrix: 95 + features: 96 + - rustdoc-link 97 + - lib-rustdoc-link,common-logger 98 + - lib-rustdoc-link 99 + - link-forever 100 + - lib-link-forever,common-logger 101 + - lib-link-forever 102 + 103 + steps: 104 + - uses: actions/checkout@v4 105 + with: 106 + fetch-depth: 0 107 + 108 + - uses: dtolnay/rust-toolchain@master 109 + with: 110 + toolchain: stable 111 + 112 + - uses: actions/cache/restore@v4 113 + with: 114 + path: | 115 + target/ 116 + key: ${{ needs.test.outputs.CACHE_KEY }} 117 + restore-keys: ${{ needs.test.outputs.CACHE_KEY_RESTORE }} 118 + 119 + - run: cargo build --release --features ${{ matrix.features }} 74 120 121 + test_rustdoc_link_ra: 122 + name: rustdoc-link RA 75 123 runs-on: ubuntu-latest 124 + 125 + needs: 126 + - test 127 + 76 128 strategy: 77 129 matrix: 78 130 ra-version: ··· 82 134 83 135 steps: 84 136 - uses: actions/checkout@v4 137 + with: 138 + fetch-depth: 0 85 139 86 140 - uses: dtolnay/rust-toolchain@master 87 141 with: 88 142 toolchain: stable 89 143 90 - - run: echo "CARGO_VERSION=$(cargo --version)" >> "$GITHUB_OUTPUT" 91 - name: get cargo version 92 - id: cargo-version 93 - 94 144 - uses: actions/cache/restore@v4 95 145 with: 96 146 path: | 97 147 target/ 98 - key: | 99 - ${{runner.os}}-${{steps.cargo-version.outputs.CARGO_VERSION}}-${{hashFiles('**/Cargo.toml')}}-${{hashFiles('**/Cargo.lock')}}-${{github.workflow}}-${{github.job}} 100 - restore-keys: | 101 - ${{runner.os}}-${{steps.cargo-version.outputs.CARGO_VERSION}}-${{hashFiles('**/Cargo.toml')}}-${{hashFiles('**/Cargo.lock')}}- 102 - ${{runner.os}}-${{steps.cargo-version.outputs.CARGO_VERSION}}-${{hashFiles('**/Cargo.toml')}}- 103 - ${{runner.os}}-${{steps.cargo-version.outputs.CARGO_VERSION}}- 148 + key: ${{ needs.test.outputs.CACHE_KEY }} 149 + restore-keys: ${{ needs.test.outputs.CACHE_KEY_RESTORE }} 104 150 105 151 - run: cargo run --package util-rust-analyzer -- download 106 152 env:
+86
.github/workflows/docs.yml
··· 1 + name: Publish docs 2 + 3 + on: 4 + push: 5 + branches: 6 + - main 7 + 8 + release: 9 + types: 10 + - published 11 + 12 + env: 13 + CARGO_TERM_COLOR: always 14 + 15 + jobs: 16 + build: 17 + name: Build 18 + runs-on: ubuntu-latest 19 + 20 + steps: 21 + - uses: actions/checkout@v4 22 + with: 23 + fetch-tags: true 24 + 25 + - uses: dtolnay/rust-toolchain@stable 26 + - uses: cargo-bins/cargo-binstall@b9bf4400702f721d469eec4d280125f650c85638 27 + - uses: denoland/setup-deno@v2 28 + with: 29 + deno-version: v2.x 30 + 31 + - name: Get cache key 32 + run: | 33 + CARGO_VERSION=$(cargo --version) 34 + echo "CACHE_KEY=${{runner.os}}-${{runner.arch}}-$CARGO_VERSION-${{hashFiles('**/Cargo.toml')}}-${{hashFiles('**/Cargo.lock')}}-${{github.workflow}}-${{github.job}}" >> "$GITHUB_OUTPUT" 35 + { 36 + echo "CACHE_KEY_RESTORE<<EOF" 37 + echo "${{runner.os}}-${{runner.arch}}-$CARGO_VERSION-${{hashFiles('**/Cargo.toml')}}-${{hashFiles('**/Cargo.lock')}}-" 38 + echo "${{runner.os}}-${{runner.arch}}-$CARGO_VERSION-${{hashFiles('**/Cargo.toml')}}-" 39 + echo "${{runner.os}}-${{runner.arch}}-$CARGO_VERSION-" 40 + echo "EOF" 41 + } >> "$GITHUB_OUTPUT" 42 + id: cache-key 43 + 44 + - uses: actions/cache/restore@v4 45 + with: 46 + path: | 47 + target/ 48 + key: ${{ steps.cache-key.outputs.CACHE_KEY }} 49 + restore-keys: ${{ steps.cache-key.outputs.CACHE_KEY_RESTORE }} 50 + 51 + - run: cargo bin --install 52 + - run: cargo run --package util-rust-analyzer -- download 53 + 54 + - run: cargo bin mdbook build 55 + working-directory: docs 56 + env: 57 + RUST_LOG: info 58 + 59 + - run: cargo run --package util-mdbook-socials -- . 60 + working-directory: docs 61 + env: 62 + RUST_LOG: info 63 + 64 + - uses: actions/upload-pages-artifact@v3 65 + with: 66 + path: docs/dist 67 + 68 + deploy: 69 + runs-on: ubuntu-latest 70 + 71 + needs: build 72 + 73 + if: ${{ github.event_name == 'release' && !github.event.release.prerelease && github.repository_owner == 'tonywu6' }} 74 + 75 + permissions: 76 + pages: write 77 + id-token: write 78 + 79 + environment: 80 + name: github-pages 81 + url: ${{ steps.deployment.outputs.page_url }} 82 + 83 + steps: 84 + - name: Deploy to GitHub Pages 85 + id: deployment 86 + uses: actions/deploy-pages@v4
+64
.github/workflows/release-plz.yml
··· 1 + name: release-plz 2 + 3 + permissions: 4 + pull-requests: write 5 + contents: write 6 + 7 + on: 8 + push: 9 + branches: 10 + - main 11 + 12 + env: 13 + CARGO_TERM_COLOR: always 14 + 15 + jobs: 16 + pr: 17 + name: Pull request 18 + runs-on: ubuntu-latest 19 + 20 + if: ${{ github.repository_owner == 'tonywu6' }} 21 + 22 + permissions: 23 + contents: write 24 + pull-requests: write 25 + 26 + concurrency: 27 + group: release-plz-${{ github.ref }} 28 + cancel-in-progress: false 29 + 30 + steps: 31 + - uses: actions/checkout@v4 32 + with: 33 + fetch-depth: 0 34 + # token is required to not commit as github-actions[bot] 35 + # otherwise CI will not run 36 + token: ${{ secrets.RELEASE_PLZ_GITHUB_TOKEN }} 37 + - uses: dtolnay/rust-toolchain@stable 38 + - uses: release-plz/action@7419a2cb1535b9c0e852b4dec626967baf65c022 39 + with: 40 + command: release-pr 41 + env: 42 + # token is required to not commit as github-actions[bot] 43 + GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_GITHUB_TOKEN }} 44 + 45 + # release: 46 + # name: Release 47 + # runs-on: ubuntu-latest 48 + 49 + # if: ${{ github.repository_owner == 'tonywu6' }} 50 + 51 + # permissions: 52 + # contents: write 53 + 54 + # steps: 55 + # - uses: actions/checkout@v4 56 + # with: 57 + # fetch-depth: 0 58 + # - uses: dtolnay/rust-toolchain@stable 59 + # - uses: release-plz/action@7419a2cb1535b9c0e852b4dec626967baf65c022 60 + # with: 61 + # command: release 62 + # env: 63 + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 64 + # CARGO_REGISTRY_TOKEN: ${{ secrets.RELEASE_PLZ_PUBLISH_TOKEN }}
+10
.prettierrc.mjs
··· 1 + // @ts-check 2 + 1 3 /** @type {import("prettier").Config} */ 2 4 const config = { 3 5 printWidth: 88, 4 6 proseWrap: "always", 5 7 tabWidth: 2, 6 8 useTabs: false, 9 + overrides: [ 10 + { 11 + files: [".github/workflows/**/*.yml"], 12 + options: { 13 + proseWrap: "preserve", 14 + }, 15 + }, 16 + ], 7 17 }; 8 18 9 19 export default config;
+3 -3
README.md
··· 1 - ![mdbookkit hero image](docs/src/media/banner.webp) 1 + [![mdbookkit hero image](docs/src/media/banner.webp)](https://tonywu6.github.io/mdbookkit) 2 2 3 3 # mdbookkit 4 4 5 + ## [Read the book](https://tonywu6.github.io/mdbookkit) 6 + 5 7 [![crates.io](https://img.shields.io/crates/v/mdbookkit?style=flat-square)](https://crates.io/crates/mdbookkit) 6 8 [![documentation](https://img.shields.io/docsrs/mdbookkit?style=flat-square&label=docs.rs)](https://docs.rs/mdbookkit) 7 9 [![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/mdbookkit?style=flat-square)](/LICENSE-APACHE.md) 8 - 9 - ## [Read the book](https://tonywu6.github.io/mdbookkit)
+1
docs/app/build/build.ts
··· 13 13 outdir: relpath("../../src/app"), 14 14 entryNames: "[name]-[hash]", 15 15 metafile: true, 16 + logLevel: Deno.env.get("CI") ? "info" : undefined, 16 17 }); 17 18 18 19 // generate an `app/dist.css` for mdBook that actually imports the bundle
+6 -6
docs/book.toml
··· 27 27 28 28 [preprocessor.rustdoc-link-options] 29 29 before = ["rustdoc-link"] 30 - command = "cargo run --quiet --package util-clap-reflect -- --reflect rustdoc-link-options" 30 + command = "cargo run --package util-clap-reflect -- --reflect rustdoc-link-options" 31 31 32 32 [preprocessor.link-forever-options] 33 33 before = ["rustdoc-link"] 34 - command = "cargo run --quiet --package util-clap-reflect -- --reflect link-forever-options" 34 + command = "cargo run --package util-clap-reflect -- --reflect link-forever-options" 35 35 36 36 [preprocessor.rustdoc-link] 37 37 after = ["links"] 38 38 cache-dir = "build" 39 39 cargo-features = ["clap/unstable-doc"] 40 - command = "cargo run --quiet --package mdbookkit --bin mdbook-rustdoc-link --all-features --release" 40 + command = "cargo run --package mdbookkit --bin mdbook-rustdoc-link --all-features --release" 41 41 manifest-dir = "." 42 - rust-analyzer = "cargo run --quiet --package util-rust-analyzer --all-features -- analyzer" 42 + rust-analyzer = "cargo run --package util-rust-analyzer --all-features -- analyzer" 43 43 44 44 [preprocessor.link-forever] 45 45 after = ["rustdoc-link"] 46 46 always-link = [".rs"] 47 47 book-url = "https://tonywu6.github.io/mdbookkit/" 48 - command = "cargo run --quiet --package mdbookkit --bin mdbook-link-forever --all-features --release" 48 + command = "cargo run --package mdbookkit --bin mdbook-link-forever --all-features --release" 49 49 50 50 [preprocessor.rust-analyzer-version] 51 51 after = ["rustdoc-link"] 52 - command = "cargo run --quiet --package util-rust-analyzer --all-features -- version" 52 + command = "cargo run --package util-rust-analyzer --all-features -- version" 53 53 54 54 [preprocessor.alerts] 55 55 after = ["rustdoc-link"]
+5
release-plz.toml
··· 1 + [workspace] 2 + release_always = false 3 + 4 + [[package]] 5 + name = "mdbookkit"