1- name : Build and Publish Storybook to GitHub Pages
1+ name : Build and Deploy Documentation
22
33on :
44 push :
55 branches :
6- - ' main' # Change this to your main branch name if different
6+ - main # or your default branch
77
88permissions :
99 contents : read
1010 pages : write
1111 id-token : write
1212
1313jobs :
14- deploy :
14+ build-and-deploy :
15+ runs-on : ubuntu-latest
1516 environment :
1617 name : github-pages
17- url : ${{ steps.build-publish.outputs.page_url }}
18- runs-on : ubuntu-latest
18+ url : ${{ steps.deployment.outputs.page_url }}
1919 steps :
20- - id : build-publish
21- 20+ - name : Checkout
21+ uses : actions/checkout@v3
22+
23+ - name : Setup Node.js
24+ uses : actions/setup-node@v3
25+ with :
26+ node-version : ' 18'
27+ cache : ' npm'
28+
29+ - name : Install dependencies
30+ run : npm ci
31+
32+ # Step 1: Build Storybook first
33+ - name : Build Storybook
34+ run : npm run build-storybook
35+
36+ # Step 2: Generate TypeDoc into a subdirectory of Storybook
37+ - name : Generate TypeDoc documentation
38+ run : npx typedoc --out storybook-static/api src/index.ts
39+
40+ # Step 3: Create a simple navigation page (optional)
41+ - name : Create navigation page
42+ run : |
43+ echo '<!DOCTYPE html>
44+ <html>
45+ <head>
46+ <meta charset="UTF-8">
47+ <title>Project Documentation</title>
48+ <style>
49+ body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; max-width: 800px; margin: 0 auto; padding: 2rem; }
50+ h1 { border-bottom: 1px solid #eaecef; }
51+ .nav-links { display: flex; gap: 2rem; margin: 2rem 0; }
52+ .nav-link { display: inline-block; padding: 0.5rem 1rem; background-color: #0366d6; color: white; text-decoration: none; border-radius: 4px; }
53+ </style>
54+ </head>
55+ <body>
56+ <h1>Project Documentation</h1>
57+ <div class="nav-links">
58+ <a class="nav-link" href="./index.html">Component Library</a>
59+ <a class="nav-link" href="./api/index.html">API Documentation</a>
60+ </div>
61+ </body>
62+ </html>' > storybook-static/docs-home.html
63+
64+ - name : Setup Pages
65+ uses : actions/configure-pages@v3
66+
67+ - name : Upload artifact
68+ uses : actions/upload-pages-artifact@v2
2269 with :
23- # Adjust these settings based on your project setup
24- path : storybook-static # Output folder from the build-storybook command
25- install_command : npm install # or yarn install
26- build_command : npm run build-storybook # or yarn build-storybook
70+ path : ' ./storybook-static'
71+
72+ - name : Deploy to GitHub Pages
73+ id : deployment
74+ uses : actions/deploy-pages@v2
0 commit comments