Skip to content

Commit 6b14864

Browse files
Add GitHub Pages deployment workflow
- Create GitHub Actions workflow for automatic deployment on main branch pushes - Configure Vite base path for GitHub Pages hosting - Set up build and deploy pipeline with proper permissions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 496a0a3 commit 6b14864

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

.github/workflows/deploy.yml

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

vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default defineConfig({
77
plugins: [react()],
88
// Set base to '/' for local testing, or to your repo name for GitHub Pages
99
// e.g., base: '/example-remote-client/' for https://username.github.io/example-remote-client/
10-
base: '/',
10+
base: process.env.NODE_ENV === 'production' ? '/example-remote-client/' : '/',
1111
resolve: {
1212
alias: {
1313
'@': path.resolve(__dirname, './src'),

0 commit comments

Comments
 (0)