fix: add type annotation to doctest to fix type inference error #27
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: Documentation | |
| on: | |
| push: | |
| tags: ['v*'] | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| # Skip pre-release tags (rc, alpha, beta) | |
| if: ${{ !contains(github.ref, '-') }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install mdBook | |
| run: | | |
| mkdir -p $HOME/.local/bin | |
| curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz | tar -xz -C $HOME/.local/bin | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - name: Get version info | |
| id: version | |
| run: | | |
| VERSION="${GITHUB_REF#refs/tags/}" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Build current docs | |
| working-directory: docs | |
| run: mdbook build | |
| - name: Fetch existing docs (for versioning) | |
| run: | | |
| mkdir -p _site | |
| # Try to fetch existing gh-pages content | |
| git fetch origin gh-pages:gh-pages 2>/dev/null || true | |
| if git rev-parse --verify gh-pages >/dev/null 2>&1; then | |
| git worktree add _site gh-pages | |
| fi | |
| - name: Organize versioned docs | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| # Create versioned directory | |
| rm -rf _site/$VERSION | |
| mkdir -p _site/$VERSION | |
| cp -r docs/book/* _site/$VERSION/ | |
| # Update latest to point to this version | |
| rm -rf _site/latest | |
| mkdir -p _site/latest | |
| cp -r docs/book/* _site/latest/ | |
| # Update versions.json | |
| cd _site | |
| { | |
| echo "[" | |
| echo " \"latest\"" | |
| for v in $(ls -d v[0-9]* 2>/dev/null | sort -Vr | head -10); do | |
| echo " ,\"$v\"" | |
| done | |
| echo "]" | |
| } > versions.json | |
| # Create index redirect to latest | |
| cat > index.html << 'EOF' | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="refresh" content="0; url=latest/"> | |
| <script>window.location.href = "latest/";</script> | |
| </head> | |
| <body> | |
| <p>Redirecting to <a href="latest/">latest documentation</a>...</p> | |
| </body> | |
| </html> | |
| EOF | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: _site | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |