Add mdBook documentation site skeleton #1
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: Docs | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'docs/**' | |
| - '.github/workflows/docs.yml' | |
| pull_request: | |
| paths: | |
| - 'docs/**' | |
| - '.github/workflows/docs.yml' | |
| workflow_dispatch: | |
| concurrency: | |
| group: docs-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| MDBOOK_VERSION: '0.4.52' | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Cache mdBook binary | |
| id: cache-mdbook | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/bin/mdbook | |
| key: mdbook-${{ runner.os }}-${{ env.MDBOOK_VERSION }} | |
| - name: Install mdBook | |
| if: steps.cache-mdbook.outputs.cache-hit != 'true' | |
| run: cargo install mdbook --version ${{ env.MDBOOK_VERSION }} --locked | |
| - name: Build book | |
| run: mdbook build docs | |
| - name: Test book | |
| run: mdbook test docs | |
| - name: Upload Pages artifact | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: docs/book | |
| deploy: | |
| name: Deploy | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |