Skip to content

Commit 6fb8c1e

Browse files
Deploy to GH pages
1 parent c779f30 commit 6fb8c1e

File tree

5 files changed

+84
-3
lines changed

5 files changed

+84
-3
lines changed

.github/workflows/deploy.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch: {}
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: pages
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: 20
28+
cache: 'npm'
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Build
34+
env:
35+
# Serve under /<repo>/ for project Pages
36+
BASE_PATH: "/${{ github.event.repository.name }}/"
37+
run: npm run build
38+
39+
- name: Upload Pages artifact
40+
uses: actions/upload-pages-artifact@v3
41+
with:
42+
path: dist
43+
44+
deploy:
45+
needs: build
46+
runs-on: ubuntu-latest
47+
environment:
48+
name: github-pages
49+
url: ${{ steps.deployment.outputs.page_url }}
50+
steps:
51+
- name: Deploy to GitHub Pages
52+
id: deployment
53+
uses: actions/deploy-pages@v4
54+

README.local.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ Quickstart
88
- Dev: `npm run dev` then open the printed URL.
99
- Build: `npm run build` and `npm run preview`.
1010

11+
Deploy to GitHub Pages
12+
- Push this repo to GitHub (default branch `main`).
13+
- GitHub Actions workflow `.github/workflows/deploy.yml` builds and publishes to Pages.
14+
- Enable Pages: Repo Settings → Pages → Build and deployment → Source: GitHub Actions.
15+
- Your site will be at `https://<user>.github.io/<repo>/`.
16+
17+
Notes on hosting
18+
- Vite `base` is set from `BASE_PATH`. The workflow sets it to `/<repo>/` so assets resolve correctly on Pages.
19+
- WebGPU does not require COOP/COEP. If you later use WASM multithreading, GitHub Pages cannot set COOP/COEP headers.
20+
1121
Notes
1222
- First load downloads model artifacts (hundreds of MB). They are cached for subsequent runs.
1323
- Model menu defaults to tiny options (1–2B params) for smoother UX. Larger models may be slow or fail on low‑VRAM GPUs.
@@ -23,4 +33,3 @@ Project Structure
2333
- `src/ui/model/models.ts`: Model presets. Adjust as needed.
2434
- `src/ui/chat/*`: Chat state and UI.
2535
- `src/utils/useIndexedDB.ts`: Minimal IndexedDB helper used to persist chats per model.
26-

package-lock.json

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
"react-dom": "^18.3.1"
1616
},
1717
"devDependencies": {
18-
"@vitejs/plugin-react": "^4.3.1",
18+
"@types/node": "^24.3.1",
1919
"@types/react": "^18.3.5",
2020
"@types/react-dom": "^18.3.0",
21+
"@vitejs/plugin-react": "^4.3.1",
2122
"typescript": "^5.5.4",
2223
"vite": "^5.4.0"
2324
}

vite.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import react from '@vitejs/plugin-react';
33

44
// https://vitejs.dev/config/
55
export default defineConfig({
6+
// Allow deploying under a subpath (e.g., GitHub Pages /<repo>/)
7+
base: process.env.BASE_PATH ?? '/',
68
plugins: [react()],
79
server: {
810
port: 5173,
911
strictPort: true
1012
}
1113
});
12-

0 commit comments

Comments
 (0)