Deploy Storybook to GitHub Pages #5
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: Deploy Storybook to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: {} | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| 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 | |
| - name: Build Storybook | |
| run: npm run build-storybook | |
| - name: Debug list Storybook output | |
| run: | | |
| echo "Working directory: $(pwd)" | |
| echo "List repository root:" | |
| ls -la | |
| echo "Check for storybook-static directory:" | |
| if [ -d ./storybook-static ]; then | |
| echo "storybook-static exists - listing contents:" | |
| ls -la ./storybook-static | |
| else | |
| echo "storybook-static does not exist at ./storybook-static" | |
| fi | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| publish_dir: ./storybook-static | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_branch: gh-pages | |
| keep_files: false | |
| allow_empty_commit: false |