Skip to content

Commit cb33a28

Browse files
committed
Add Storybook GitHub Pages deployment
1 parent 01a3462 commit cb33a28

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Deploy Storybook to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: '20'
19+
cache: 'npm'
20+
21+
- name: Install dependencies
22+
run: npm ci
23+
24+
- name: Build Storybook
25+
run: npm run build-storybook
26+
27+
- name: Deploy to GitHub Pages
28+
uses: JamesIves/github-pages-deploy-action@v4
29+
with:
30+
folder: storybook-static
31+
branch: gh-pages

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ dist-ssr
2828
# TypeScript cache
2929
*.tsbuildinfo
3030
tsconfig.tsbuildinfo
31+
32+
# Storybook
33+
storybook-static/

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
2424
"preview": "vite preview",
2525
"storybook": "npx storybook dev -p 6006",
26-
"build-storybook": "npx storybook build"
26+
"build-storybook": "npx storybook build",
27+
"deploy-storybook": "storybook-to-ghpages"
2728
},
2829
"dependencies": {
2930
"@react-three/drei": "^9.99.0",
@@ -53,7 +54,8 @@
5354
"eslint-plugin-react-hooks": "^4.6.0",
5455
"eslint-plugin-react-refresh": "^0.4.5",
5556
"typescript": "^5.2.2",
56-
"vite": "^5.1.0"
57+
"vite": "^5.1.0",
58+
"storybook-to-ghpages": "^1.0.0"
5759
},
5860
"peerDependencies": {
5961
"react": "^18.2.0",

0 commit comments

Comments
 (0)