docs: set up guide #2
This file contains 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: guide | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4.2.2 | |
- name: Install rust toolchain | |
id: toolchain | |
run: | | |
rustup toolchain install stable --profile minimal | |
rustup override set stable | |
- name: Install mdBook | |
uses: camshaft/install@v1 | |
with: | |
crate: mdbook | |
- name: Install taplo | |
uses: camshaft/install@v1 | |
with: | |
crate: taplo-cli | |
bins: "taplo" | |
- name: Install typos | |
uses: camshaft/install@v1 | |
with: | |
crate: typos-cli | |
bins: "typos" | |
- name: Setup cache | |
uses: camshaft/rust-cache@v1 | |
- name: Build book | |
env: | |
MDBOOK_OUTPUT__HTML__SITE_url: "/duvet" | |
run: cargo xtask guide | |
- name: Setup Pages | |
id: pages | |
if: github.event_name == 'push' | |
uses: actions/configure-pages@v5 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./guide/build | |
# Deployment job | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
if: github.event_name == 'push' | |
uses: actions/deploy-pages@v4 |