Skip to content

Commit 16a3238

Browse files
Setup GitHub Pages deployment
- Add GitHub Actions workflow for automatic deployment - Configure Vite for GitHub Pages with proper base URL - Update build configuration for production deployment
1 parent fd5917d commit 16a3238

File tree

2 files changed

+52
-2
lines changed

2 files changed

+52
-2
lines changed

.github/workflows/deploy.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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-and-deploy:
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 application
27+
run: npm run build
28+
29+
- name: Setup Pages
30+
uses: actions/configure-pages@v4
31+
32+
- name: Upload artifact
33+
uses: actions/upload-pages-artifact@v3
34+
with:
35+
path: './dist'
36+
37+
- name: Deploy to GitHub Pages
38+
id: deployment
39+
uses: actions/deploy-pages@v4
40+
41+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
42+
permissions:
43+
contents: read
44+
pages: write
45+
id-token: write
46+
47+
# Allow one concurrent deployment
48+
concurrency:
49+
group: "pages"
50+
cancel-in-progress: true

vite.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { resolve } from 'path'
55
// https://vitejs.dev/config/
66
export default defineConfig({
77
plugins: [vue()],
8-
// Use relative paths for deployment flexibility
9-
base: './',
8+
// GitHub Pages deployment configuration
9+
base: process.env.NODE_ENV === 'production' ? '/historisnap/' : './',
1010
resolve: {
1111
alias: {
1212
'@': resolve(__dirname, 'src'),

0 commit comments

Comments
 (0)