name: 'Chromatic' # - [Automate Chromatic with GitHub Actions • Chromatic docs]( https://www.chromatic.com/docs/github-actions/ ) on: workflow_dispatch: # Allow manual triggering pull_request: branches: [main] jobs: chromatic-deployment: runs-on: ubuntu-latest # Only run for PRs from version-bump-* branches or manual triggers if: github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'version-bump-') steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 # Required for Chromatic baseline - name: Install pnpm uses: pnpm/action-setup@v4 with: version: 10 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20' cache: 'pnpm' - name: Cache tool outputs uses: actions/cache@v4 with: path: | .cache storybook-static tsconfig.tsbuildinfo key: storybook-cache-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('src/**/*.{ts,vue,js}', '*.config.*', '.storybook/**/*') }} restore-keys: | storybook-cache-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}- storybook-cache-${{ runner.os }}- storybook-tools-cache-${{ runner.os }}- - name: Install dependencies run: pnpm install --frozen-lockfile - name: Build Storybook and run Chromatic id: chromatic uses: chromaui/action@latest with: projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} buildScriptName: build-storybook autoAcceptChanges: 'main' # Auto-accept changes on main branch exitOnceUploaded: true # Don't wait for UI tests to complete