mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-01 00:42:49 +08:00
GitHub Pages only serves static files, but the real app needs a Node gateway and Rust connector to speak the TS3 protocol - neither of which can run there. This adds a fake WebSocket (DemoSocket) that simulates a connection with canned channels/clients entirely client-side, gated behind VITE_DEMO_MODE so the normal Docker build is unaffected, plus a GitHub Actions workflow that builds and publishes it to Pages. Also fixes a real bug surfaced while testing the disconnect flow: a clean disconnect incorrectly showed "Connection closed before the server responded" because the socket's onclose handler couldn't tell a clean disconnect apart from one that never connected. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
58 lines
1.1 KiB
YAML
58 lines
1.1 KiB
YAML
name: Deploy demo to GitHub Pages
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- "web/**"
|
|
- ".github/workflows/deploy-demo.yml"
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
pages: write
|
|
id-token: write
|
|
|
|
concurrency:
|
|
group: pages
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: npm
|
|
cache-dependency-path: web/package-lock.json
|
|
|
|
- name: Install dependencies
|
|
working-directory: web
|
|
run: npm ci
|
|
|
|
- name: Build (demo mode)
|
|
working-directory: web
|
|
env:
|
|
VITE_DEMO_MODE: "true"
|
|
VITE_BASE_PATH: /webspeak3/
|
|
run: npm run build
|
|
|
|
- uses: actions/configure-pages@v5
|
|
|
|
- uses: actions/upload-pages-artifact@v3
|
|
with:
|
|
path: web/dist
|
|
|
|
deploy:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
steps:
|
|
- id: deployment
|
|
uses: actions/deploy-pages@v4
|