Skip to content

Commit 3655829

Browse files
kvapsclaude
andcommitted
ci: deploy to GitHub Pages on push
Vite base path switches to /stackmind/ only for production builds so local dev keeps serving from /. GitHub Actions workflow builds with pnpm, uploads dist as a Pages artifact and deploys via actions/deploy-pages. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
1 parent e8f03fa commit 3655829

2 files changed

Lines changed: 47 additions & 2 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [master, 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+
- uses: actions/checkout@v4
22+
- uses: pnpm/action-setup@v4
23+
with:
24+
version: 10
25+
- uses: actions/setup-node@v4
26+
with:
27+
node-version: 22
28+
cache: pnpm
29+
- run: pnpm install --frozen-lockfile
30+
- run: pnpm build
31+
- uses: actions/configure-pages@v5
32+
- uses: actions/upload-pages-artifact@v3
33+
with:
34+
path: dist
35+
36+
deploy:
37+
needs: build
38+
runs-on: ubuntu-latest
39+
environment:
40+
name: github-pages
41+
url: ${{ steps.deployment.outputs.page_url }}
42+
steps:
43+
- id: deployment
44+
uses: actions/deploy-pages@v4

vite.config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { defineConfig } from 'vite'
22
import vue from '@vitejs/plugin-vue'
33
import { fileURLToPath, URL } from 'node:url'
44

5-
export default defineConfig({
5+
export default defineConfig(({ command }) => ({
6+
base: command === 'build' ? '/stackmind/' : '/',
67
plugins: [vue()],
78
resolve: {
89
alias: {
@@ -12,4 +13,4 @@ export default defineConfig({
1213
server: {
1314
port: 5174,
1415
},
15-
})
16+
}))

0 commit comments

Comments
 (0)