Skip to content

Port website dev docs generated content scripts from JS to Rust to avoid intermediate parsing #1123

Port website dev docs generated content scripts from JS to Rust to avoid intermediate parsing

Port website dev docs generated content scripts from JS to Rust to avoid intermediate parsing #1123

Workflow file for this run

name: "Website"
on:
workflow_dispatch: {}
push:
branches:
- master
paths:
- website/**
pull_request:
paths:
- website/**
env:
CARGO_TERM_COLOR: always
INDEX_HTML_HEAD_INCLUSION: <script defer data-domain="graphite.art" data-api="/visit/event" src="/visit/script.hash.js"></script>
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
pull-requests: write
steps:
- name: 📥 Clone repository
uses: actions/checkout@v6
- name: 🟢 Install Node.js
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
- name: 🕸 Install Zola
uses: taiki-e/install-action@v2
with:
tool: zola@0.22.0
- name: 🔍 Check if `website/other` directory changed
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
website-other:
- "website/other/**"
- name: ✂ Replace template in <head> of index.html
run: |
# Remove the INDEX_HTML_HEAD_INCLUSION environment variable for build links (not master deploys)
git rev-parse --abbrev-ref HEAD | grep master > /dev/null || export INDEX_HTML_HEAD_INCLUSION=""
- name: 💿 Obtain cache of auto-generated code docs artifacts
id: cache-website-code-docs
uses: actions/cache/restore@v5
with:
path: website/generated
key: website-code-docs
- name: 📁 Fallback in case auto-generated code docs artifacts weren't cached
if: steps.cache-website-code-docs.outputs.cache-hit != 'true'
run: |
echo "🦀 Initial system version of Rust:"
rustc --version
rustup update stable
echo "🦀 Latest updated version of Rust:"
rustc --version
cargo run -p crate-hierarchy-viz -- website/generated
cargo run -p editor-message-tree -- website/generated
- name: 🔧 Install website npm dependencies
run: |
cd website
npm ci
- name: 📃 Generate node catalog documentation
run: cargo run -p node-docs -- website/content/learn/node-catalog
- name: 🌐 Build Graphite website with Zola
env:
MODE: prod
run: |
cd website
npm run check
zola --config config.toml build --minify
- name: 📤 Publish to Cloudflare Pages
continue-on-error: true
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: npx wrangler@3 pages deploy "website/public" --project-name="graphite-website" --commit-dirty=true