name: "Build & Deploy Documentation"
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: deploy
cancel-in-progress: false
jobs:
rustdoc:
name: Build API docs
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: 1
steps:
- name: Checkout repository
uses: actions/checkout@v5
- uses: cachix/install-nix-action@v31
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare Dev Environment
run: |
eval "$(nix print-dev-env)"
set -x
cargo clean --doc ; cargo doc --no-deps --workspace --all-features
# Add redirect
echo '<meta http-equiv="refresh" content="0;url=nix_bindings/index.html">' > target/doc/index.html
- name: Remove lock file
run: rm target/doc/.lock
- name: Setup pages
id: pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: target/doc
deploy:
name: Deploy Documentation
runs-on: ubuntu-latest
needs: rustdoc
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4