---
name: Deploy Documentation
"on":
push:
branches: [main]
paths:
- 'docs/**'
- 'site/**'
- 'CLAUDE.md'
- 'Cargo.toml'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build-docs:
name: Build Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
- name: Setup Rust
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 with:
toolchain: stable
- name: Build rustdoc
run: cargo doc --no-deps --all-features
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e with:
node-version: '22'
- name: Install site dependencies
working-directory: site
run: npm ci || npm install
- name: Use social preview as OG image
run: |
if [ -f .github/social-preview.svg ]; then
cp .github/social-preview.svg site/public/og-image.svg
echo "Copied .github/social-preview.svg to site/public/og-image.svg"
fi
- name: Generate content
working-directory: site
run: npm run generate
- name: Build Astro site
working-directory: site
run: |
npx astro build \
--site https://zircote.github.io/rlm-rs
- name: Embed rustdoc
run: |
mkdir -p site/dist/api
cp -r target/doc/* site/dist/api/
REDIR='<meta http-equiv="refresh"'
REDIR="$REDIR"' content="0; url=rlm_rs">'
echo "$REDIR" > site/dist/api/index.html
- name: Setup Pages
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d
- name: Upload artifact
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 with:
path: site/dist
deploy:
name: Deploy to GitHub Pages
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build-docs
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128