Skip to content

fix(ui): add the object category to CATEGORY_COLORS #62

fix(ui): add the object category to CATEGORY_COLORS

fix(ui): add the object category to CATEGORY_COLORS #62

Workflow file for this run

name: Deploy Documentation
on:
push:
branches:
- main
paths:
- 'docs/**'
- 'ui/**'
- 'bindings/wasm/**'
- '.github/workflows/docs.yml'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
# Build mdBook documentation
- name: Setup mdBook
uses: peaceiris/actions-mdbook@ee69d230fe19748b7abf22df32acaa93833fad08 # v2
with:
mdbook-version: 'latest'
- name: Build documentation
run: mdbook build docs
# Build WASM for UI
- name: Setup Rust
uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable
with:
targets: wasm32-unknown-unknown
- name: Install wasm-pack
uses: taiki-e/install-action@3d7d7cd5ac7f994c1892ae0c06165095b9139094 # v2
with:
tool: wasm-pack@0.14.0
- name: Cache cargo
uses: actions/cache@v5
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
bindings/wasm/target/
# `Cargo.lock` is gitignored (this is a library), so a hashFiles
# over the (absent) lockfile would yield the empty hash. Key off
# the manifest instead to get meaningful cache busts when deps
# change.
key: ${{ runner.os }}-wasm-${{ hashFiles('bindings/wasm/Cargo.toml') }}
restore-keys: ${{ runner.os }}-wasm-
- name: Build WASM
run: cd bindings/wasm && ./build.sh
# Build UI demo and embed bundle
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
# No `cache:` here — `ui/package-lock.json` is generated on first
# `npm install`, but isn't checked in. Add `cache: 'npm'` once
# a lockfile is committed.
# Wire the freshly-built local WASM as a `file:` dep so `npm install`
# installs it from disk instead of the registry. The published
# version may not exist yet (release tag fires later in the v5.0.0
# cycle), and the previous `npm link` + version-pin dance proved
# fragile: tsc -b couldn't resolve types through the symlink, so
# the docs UI build (which runs `tsc -b && vite build`) failed even
# though CI's `npm run build:lib` (vite-only) passed. docs.yml
# doesn't publish, so this in-memory edit is build-only.
# Single-quoted because the unquoted step name "...as a file: dep"
# contained a colon+space, which YAML parses as a mapping key and
# caused the entire workflow to fail to load (zero jobs, 0s
# startup failure) when merged in #52. Don't drop the quotes.
- name: 'Wire local WASM into ui/package.json as a file: dep'
run: cd ui && npm pkg set "dependencies.@goplasmatic/datalogic-wasm=file:../bindings/wasm/pkg"
- name: Install UI dependencies
run: cd ui && npm install
- name: Build UI demo
run: cd ui && npm run build
env:
GITHUB_ACTIONS: true
- name: Build UI embed bundle
run: cd ui && npm run build:embed
# Copy embed bundle to docs source assets (before mdbook build picks it up)
- name: Copy embed bundle to docs source
run: |
mkdir -p docs/src/assets
cp ui/dist-embed/datalogic-embed.js docs/src/assets/
cp ui/dist-embed/datalogic-embed.css docs/src/assets/
# Rebuild mdbook to include embed files
- name: Rebuild documentation with embed bundle
run: mdbook build docs
# Combine outputs
- name: Copy UI demo to docs
run: |
mkdir -p docs/book/playground
cp -r ui/dist/* docs/book/playground/
- name: Setup Pages
uses: actions/configure-pages@v6
- name: Upload artifact
uses: actions/upload-pages-artifact@v5
with:
path: 'docs/book'
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
uses: actions/deploy-pages@v5