Deploy Storybook to GitHub Pages #17
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: | |
| workflow_run: | |
| workflows: [Release] | |
| types: [completed] | |
| workflow_dispatch: | |
| inputs: | |
| deploy: | |
| description: Deploy to GitHub Pages after build | |
| required: true | |
| default: false | |
| type: boolean | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: docs-pages-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| if: ${{ (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || github.event_name == 'workflow_dispatch' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.ref }} | |
| - uses: pnpm/action-setup@v6 | |
| - run: pnpm install --frozen-lockfile | |
| env: | |
| HUSKY: 0 | |
| - name: Build Storybook static site | |
| run: pnpm nx run @soundtouchjs/storybook:build-storybook | |
| - name: Setup GitHub Pages | |
| if: ${{ (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || inputs.deploy }} | |
| uses: actions/configure-pages@v6 | |
| - name: Upload Storybook artifact | |
| if: ${{ (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || inputs.deploy }} | |
| uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: ./static-storybook | |
| deploy: | |
| needs: build | |
| if: ${{ (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || inputs.deploy }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |