Skip to content

Commit d81d9f0

Browse files
committed
chore: CI for GH pages
1 parent 63b5623 commit d81d9f0

File tree

5 files changed

+50
-1
lines changed

5 files changed

+50
-1
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: CI
22
on: [ push, pull_request ]
33
jobs:
4-
Build:
4+
build:
55
runs-on: ubuntu-latest
66

77
steps:
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: DEPLOY_TO_GH_PAGES
2+
on:
3+
push:
4+
branches:
5+
- main
6+
workflow_dispatch:
7+
concurrency:
8+
group: "pages"
9+
cancel-in-progress: false
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
jobs:
15+
deploy:
16+
environment:
17+
name: github-pages
18+
url: ${{ steps.deployment.outputs.page_url }}
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
- name: Use Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: 22
27+
cache: 'npm'
28+
- name: Install dependencies
29+
run: npm ci
30+
- name: Build
31+
run: xvfb-run npm run build:demo
32+
- name: Setup Pages
33+
uses: actions/configure-pages@v5
34+
- name: Upload artifact
35+
uses: actions/upload-pages-artifact@v3
36+
with:
37+
path: 'public'
38+
- name: Deploy to GitHub Pages
39+
id: deployment
40+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ node_modules
1111
dist
1212
dist-ssr
1313
*.local
14+
public
1415

1516
# Editor directories and files
1617
.vscode/*

demo.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ import react from '@vitejs/plugin-react';
55
export default defineConfig({
66
root: 'demo',
77
plugins: [ react() ],
8+
build: {
9+
outDir: '../public',
10+
emptyOutDir: true,
11+
},
812
server: {
913
open: true
1014
},
15+
test: {
16+
globals: true,
17+
},
1118
});

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"all": "run-s lint test build",
88
"start": "vite --config demo.config.js",
99
"build": "vite build",
10+
"build:demo": "vite build --config demo.config.js",
1011
"test": "vitest run",
1112
"test:watch": "vitest watch",
1213
"lint": "eslint ."

0 commit comments

Comments
 (0)