Skip to content

site: follow the system theme in the playground, pipe-first example s… #4

site: follow the system theme in the playground, pipe-first example s…

site: follow the system theme in the playground, pipe-first example s… #4

Workflow file for this run

name: pages
# Build the docs site (mdBook) and the WASM playground, and publish both as ONE
# GitHub Pages deployment: the book at the site root, the playground under
# /playground/. Pages allows a single deployment per repo, so this workflow is the
# only one that may deploy (concurrency group `pages` enforces that).
# Enable once under Settings -> Pages -> Source: GitHub Actions.
on:
push:
branches: [main]
paths:
- "docs/**"
- "playground/**"
- "src/**"
- "Cargo.toml"
- ".github/workflows/pages.yml"
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
build-deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- uses: actions/checkout@v4
# Match the toolchain pinned by rust-toolchain.toml, with the wasm target.
- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.97.0"
targets: wasm32-unknown-unknown
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
# Prebuilt binary: keeps the job Rust-toolchain-only, no compile, no pip.
- name: Install mdBook
run: |
mkdir -p "$HOME/.local/bin"
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.5.4/mdbook-v0.5.4-x86_64-unknown-linux-musl.tar.gz \
| tar -xz -C "$HOME/.local/bin"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Build WASM
run: wasm-pack build playground --target web --out-dir web/pkg --release
- name: Build the book
run: mdbook build docs
- name: Assemble site (book at root, playground under /playground/)
run: |
mkdir -p _site/playground
cp -r docs/book/. _site/
cp -r playground/web/. _site/playground/
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
with:
path: _site
- id: deploy
uses: actions/deploy-pages@v4