Files
fam 4336cde189 webgl: 新 app — 说需求→gemma 流式生成可交互 WebGL 小程序
左 sidebar 聊天说需求,右主区 运行/代码 两 tab。后端 SSE 流式把
gemma 生成的自包含纯原生 WebGL HTML 一段段回吐,前端实时显示代码、
写完丢进沙箱 iframe 跑。完全无状态(迭代靠前端回传 current_code)。
给儿子体验 WebGL。
2026-06-03 22:21:33 +01:00

58 lines
1.8 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: deploy webgl
# webgl.famzheng.me — 说需求现场生成可交互 WebGL 小程序。host shell runner(fam 用户)。
on:
push:
branches: [master]
paths:
- 'apps/webgl/**'
- 'crates/cube-core/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.gitea/workflows/deploy-webgl.yml'
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
APP: webgl
IMAGE: registry.famzheng.me/mochi/webgl
steps:
- uses: actions/checkout@v4
- name: Resolve image tag
id: tag
run: |
echo "sha=$(git rev-parse --short=12 HEAD)" >> "$GITHUB_OUTPUT"
- name: Build rust (musl static)
run: |
export PATH="$HOME/.cargo/bin:$PATH"
cargo build --release --target x86_64-unknown-linux-musl -p "$APP"
- name: Build frontend
run: |
cd "apps/$APP/frontend"
npm ci
npm run build
- name: Build & push image
env:
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
run: |
echo "$REGISTRY_TOKEN" | docker login registry.famzheng.me -u mochi --password-stdin
# FROM scratch + COPY musl binary —— 必须 --no-cache,否则 docker layer cache
# 会把 COPY binary 这层套用历史 binary(cube 平台踩过的坑)。
docker build --no-cache -f "apps/$APP/Dockerfile" -t "$IMAGE:${{ steps.tag.outputs.sha }}" .
docker push "$IMAGE:${{ steps.tag.outputs.sha }}"
- name: Initialize K8s resources
run: |
kubectl apply -f "apps/$APP/k8s/all.yaml"
- name: Roll out to k3s
run: |
kubectl -n "cube-$APP" set image "deploy/$APP" "$APP=$IMAGE:${{ steps.tag.outputs.sha }}"
kubectl -n "cube-$APP" rollout status "deploy/$APP" --timeout=120s