Skip to content

feat: add CI workflow for linting, testing, building, and deploying S… #1

feat: add CI workflow for linting, testing, building, and deploying S…

feat: add CI workflow for linting, testing, building, and deploying S… #1

Workflow file for this run

# 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/checkout@v6.0.2
- uses: pnpm/action-setup@v5.0.0
- uses: actions/setup-node@v6.3.0
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/upload-pages-artifact@v4.0.0
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/deploy-pages@v5.0.0