feat: add CI workflow for linting, testing, building, and deploying S… #1
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
| # CI: lint, test, Turbo build; upload Storybook static site; deploy to GitHub Pages (main only). | |
| # | |
| # Manual setup (once per repo): Settings → Pages → Build and deployment → Source: GitHub Actions. | |
| # If prompted, approve the `github-pages` environment for this workflow. | |
| name: CI and Storybook | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| ci: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/[email protected] | |
| - uses: pnpm/[email protected] | |
| - uses: actions/[email protected] | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Lint | |
| run: pnpm run lint | |
| - name: Test | |
| run: pnpm run test | |
| - name: Build | |
| run: pnpm run build | |
| env: | |
| STORYBOOK_BASE_PATH: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && format('/{0}/', github.event.repository.name) || '' }} | |
| - name: Upload Storybook artifact | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: actions/[email protected] | |
| with: | |
| path: apps/storybook/storybook-static | |
| deploy-storybook: | |
| name: Deploy Storybook to GitHub Pages | |
| needs: ci | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/[email protected] |