| # Licensed under the Apache-2.0 license |
| |
| name: GitHub Pages |
| |
| on: |
| push: |
| branches: [ main ] |
| workflow_dispatch: |
| |
| permissions: |
| contents: read |
| pages: write |
| id-token: write |
| |
| env: |
| CARGO_TERM_COLOR: always |
| |
| jobs: |
| build-and-deploy: |
| name: Build and Deploy to GitHub Pages |
| runs-on: ubuntu-latest |
| environment: |
| name: github-pages |
| url: ${{ steps.deployment.outputs.page_url }} |
| steps: |
| - name: Checkout |
| uses: actions/checkout@v5 |
| |
| - name: Install Rust toolchain |
| uses: dtolnay/rust-toolchain@stable |
| with: |
| components: rust-docs |
| |
| - name: Cache cargo registry |
| uses: actions/cache@v4 |
| with: |
| path: | |
| ~/.cargo/registry |
| ~/.cargo/git |
| target |
| key: ${{ runner.os }}-github-pages-cargo-${{ hashFiles('**/Cargo.lock') }} |
| |
| - name: Install mdbook and mdbook-mermaid |
| run: | |
| cargo install mdbook --locked |
| cargo install mdbook-mermaid --locked |
| |
| - name: Build mdbook documentation |
| run: cargo xtask docs |
| |
| - name: Setup Pages |
| uses: actions/configure-pages@v5 |
| |
| - name: Upload artifact |
| uses: actions/upload-pages-artifact@v4 |
| with: |
| path: ./target/book |
| |
| - name: Deploy to GitHub Pages |
| id: deployment |
| uses: actions/deploy-pages@v4 |