name: Documentation
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
name: Build Documentation
runs-on: ubuntu-latest
env:
CARGO_TARGET_DIR: ${{ github.workspace }}/target-docs-pages
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Install Rust
uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 with:
toolchain: stable
- name: Cache cargo
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 with:
workspaces: ". -> target-docs-pages"
key: docs-pages
- name: Build documentation (strict)
env:
RUSTDOCFLAGS: >-
-D warnings
-D rustdoc::broken_intra_doc_links
-D rustdoc::private_intra_doc_links
-D rustdoc::invalid_codeblock_attributes
-D rustdoc::invalid_html_tags
-D rustdoc::bare_urls
run: |
cargo doc --no-deps --all-features
- name: Build the User Manual (mdBook)
run: |
cargo install --locked mdbook
mdbook build docs
scripts/check-docs-links.sh
- name: Assemble the Pages site
run: |
set -euo pipefail
mkdir -p site
cp -R target-docs-pages/doc/. site/
cp -R target-book site/manual
cat > site/index.html <<'HTML'
<!doctype html><meta charset="utf-8">
<title>noyalib-mcp documentation</title>
<style>body{font-family:system-ui;max-width:38rem;margin:4rem auto;line-height:1.6;padding:0 1rem}</style>
<h1>noyalib-mcp documentation</h1>
<p><a href="manual/">The noyalib-mcp Manual</a> — guides, architecture, release notes.</p>
<p><a href="noyalib_mcp/">API reference</a> — rustdoc for the current main branch (releases: <a href="https://docs.rs/noyalib-mcp">docs.rs/noyalib-mcp</a>).</p>
HTML
- name: Setup Pages
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d
- name: Upload artifact
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 with:
path: site
deploy:
name: Deploy to GitHub Pages
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@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128