Update storybook.yml #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Deploy Documentation | |
| on: | |
| push: | |
| branches: | |
| - main # or your default branch | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| # Debug TypeDoc installation | |
| - name: Check TypeDoc installation | |
| run: | | |
| echo "TypeDoc version:" | |
| npx typedoc --version || echo "TypeDoc not found" | |
| echo "Current directory structure:" | |
| ls -la | |
| echo "Package.json scripts:" | |
| cat package.json | grep -A 20 '"scripts"' | |
| # Step 1: Build Storybook first | |
| - name: Build Storybook | |
| run: npm run build-storybook | |
| # Debug Storybook output | |
| - name: Check Storybook output | |
| run: | | |
| echo "Storybook output directory:" | |
| ls -la storybook-static || echo "storybook-static directory not found" | |
| # Step 2: Generate TypeDoc manually with explicit output path | |
| - name: Generate TypeDoc documentation | |
| run: | | |
| echo "Running TypeDoc directly with explicit output path..." | |
| npx typedoc --out storybook-static/api src/index.ts | |
| echo "Checking if TypeDoc output was created:" | |
| ls -la storybook-static/api || echo "api directory not found in storybook-static" | |
| # Step 3: Create a simple navigation page | |
| - name: Create navigation page | |
| run: | | |
| echo '<!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Project Documentation</title> | |
| <style> | |
| body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; max-width: 800px; margin: 0 auto; padding: 2rem; } | |
| h1 { border-bottom: 1px solid #eaecef; } | |
| .nav-links { display: flex; gap: 2rem; margin: 2rem 0; } | |
| .nav-link { display: inline-block; padding: 0.5rem 1rem; background-color: #0366d6; color: white; text-decoration: none; border-radius: 4px; } | |
| </style> | |
| </head> | |
| <body> | |
| <h1>Project Documentation</h1> | |
| <div class="nav-links"> | |
| <a class="nav-link" href="./index.html">Component Library</a> | |
| <a class="nav-link" href="./api/index.html">API Documentation</a> | |
| </div> | |
| </body> | |
| </html>' > storybook-static/docs-home.html | |
| # Final directory check before deployment | |
| - name: Final directory check | |
| run: | | |
| echo "Final directory structure before deployment:" | |
| find storybook-static -type d | sort | |
| echo "Files in storybook-static root:" | |
| ls -la storybook-static/ | |
| echo "Files in api directory (if it exists):" | |
| ls -la storybook-static/api/ || echo "API directory not found" | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: './storybook-static' | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |