Skip to content

feat: rewrite router in tu #124

feat: rewrite router in tu

feat: rewrite router in tu #124

Workflow file for this run

name: Deploy docs
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
# One in-flight Pages deploy at a time. Don't cancel a running deploy when
# a new push lands — let the previous job finish so the site stays online.
concurrency:
group: pages
cancel-in-progress: false
# **The docs site is built with @tu-lang/tu-shu** — Tu's own static site
# generator (dogfood). VitePress was the bootstrap renderer; once tu-shu
# was production-ready the deploy switched over. tu-shu reads docs/*.md,
# renders via @tu-lang/runtime's renderPage, and writes static HTML to
# docs/.tu-shu/dist/. The playground (Tu+Vite app) and tu-shu's own demo
# are staged under sub-paths.
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.28.0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build all packages
run: pnpm build
- name: Package VS Code extension
run: |
npx --yes @vscode/vsce package --no-dependencies --skip-license -o vscode-tu-latest.vsix
working-directory: packages/vscode
# Refresh static assets in docs/public/ so tu-shu's publicDir copy
# picks up the latest vsix + grammar JSON. The favicon.svg and
# llms.txt are committed; vsix and grammar are CI-fresh.
- name: Refresh assets in docs/public
run: |
mkdir -p docs/public/install docs/public/grammar
cp packages/vscode/vscode-tu-latest.vsix docs/public/install/
cp packages/vscode/syntaxes/tu.tmLanguage.json docs/public/grammar/
# Generate llms.txt by extracting the `markdown { … }` body
# out of docs/skill.tu (the migrated AI-agent skill page).
# Strips the leading 4-space indent we use inside `markdown {`
# so the agent gets a clean .md-equivalent file.
node scripts/extract-skill-llms.mjs
# Build the **main docs site** with tu-shu (Tu's own SSG). The
# build automatically copies docs/public/* into the output dir.
- name: Build docs (tu-shu)
run: TU_BASE='/tu/' node ../packages/tu-shu/dist/cli.js build
working-directory: docs
# Dogfood: build the tu-shu demo (a separate small site) and embed
# under /tu-shu-preview/ so the live deploy showcases tu-shu twice
# — once rendering the main site, once rendering its own demo.
- name: Build tu-shu demo
run: TU_BASE='/tu/tu-shu-preview/' node ../../packages/tu-shu/dist/cli.js build
working-directory: examples/tu-shu-demo
- name: Stage tu-shu demo into /tu-shu-preview/
run: |
mkdir -p docs/.tu-shu/dist/tu-shu-preview
cp -r examples/tu-shu-demo/.tu-shu/dist/* docs/.tu-shu/dist/tu-shu-preview/
# Build the playground (a Tu+Vite SPA exercising every demo plus
# the tu-xing UI library and Tailwind) and embed under /playground/.
- name: Build playground
run: TU_BASE='/tu/playground/' pnpm --filter tu-playground build
- name: Stage playground into /playground/
run: |
mkdir -p docs/.tu-shu/dist/playground
cp -r playground/dist/* docs/.tu-shu/dist/playground/
# Build the tu-xing preview SPA (storybook-style: every primitive
# in one Tu app, themed with tu-xing tokens) and embed under
# /tu-xing-preview/. Independent of the playground so users can
# link straight to the UI library showcase.
- name: Build tu-xing preview
run: TU_BASE='/tu/tu-xing-preview/' pnpm --filter '@tu-examples/tu-xing-demo' build
- name: Stage tu-xing preview into /tu-xing-preview/
run: |
mkdir -p docs/.tu-shu/dist/tu-xing-preview
cp -r examples/tu-xing-demo/dist/* docs/.tu-shu/dist/tu-xing-preview/
- name: Configure Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/.tu-shu/dist
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4