Skip to content

Commit 2c7e05c

Browse files
shankar-gpioclaude
andcommitted
Add GitHub Actions workflow for GitHub Pages deployment
Configure automated deployment to GitHub Pages on pushes to main branch. Update Vite config to support dynamic base URL for GH Pages. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 1319cd4 commit 2c7e05c

2 files changed

Lines changed: 62 additions & 0 deletions

File tree

.github/workflows/deploy.yml

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

vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import topLevelAwait from 'vite-plugin-top-level-await'
55
import { resolve } from 'path'
66

77
export default defineConfig({
8+
base: process.env.BASE_URL || '/',
89
plugins: [react(), wasm(), topLevelAwait()],
910
resolve: {
1011
alias: {

0 commit comments

Comments
 (0)