feat: set up CI, linting, and documentation automation #8
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Documentation | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| defaults: | |
| run: | |
| shell: bash | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@1.90 | |
| with: | |
| components: rustfmt, clippy | |
| - name: Setup mdBook | |
| uses: jontze/action-mdbook@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| mdbook-version: latest | |
| use-mermaid: true | |
| use-toc: true | |
| use-admonish: true | |
| - name: Install cargo-binstall | |
| uses: cargo-bins/cargo-binstall@main | |
| - name: Install mdbook plugins | |
| run: cargo binstall mdbook-tabs mdbook-i18n-helpers mdbook-alerts mdbook-yml-header mdbook-image-size --no-confirm | |
| - name: Build rustdoc | |
| run: | | |
| cargo doc --no-deps --document-private-items --target-dir target | |
| mkdir -p docs/book/api | |
| cp -r target/doc/* docs/book/api/ | |
| - name: Build mdBook | |
| run: | | |
| cd docs | |
| mdbook build | |
| - name: Setup Pages | |
| if: github.ref == 'refs/heads/main' | |
| uses: actions/configure-pages@v5 | |
| - name: Upload artifact | |
| if: github.ref == 'refs/heads/main' | |
| uses: actions/upload-pages-artifact@v4 | |
| with: | |
| path: docs/book | |
| deploy: | |
| if: github.ref == 'refs/heads/main' | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |