Skip to content

Commit 3d0330a

Browse files
committed
build: publish Storybook to Chromatic on report UI changes
Path-filtered workflow that builds Storybook and publishes to Chromatic only when src/report/web, .storybook, or the workflow itself changes. Runs on PRs for visual review and on push to main to establish baselines (--auto-accept-changes=main); --only-changed enables TurboSnap. Requires a CHROMATIC_PROJECT_TOKEN repository secret.
1 parent 195ea86 commit 3d0330a

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

.github/workflows/chromatic.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Chromatic
2+
3+
# Publish the report's Storybook to Chromatic for visual review. Only runs when
4+
# the report UI (or this workflow / the Storybook config) changes.
5+
on:
6+
push:
7+
branches: [main]
8+
paths:
9+
- 'src/report/web/**'
10+
- '.storybook/**'
11+
- '.github/workflows/chromatic.yml'
12+
pull_request:
13+
paths:
14+
- 'src/report/web/**'
15+
- '.storybook/**'
16+
- '.github/workflows/chromatic.yml'
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
20+
cancel-in-progress: true
21+
22+
permissions:
23+
contents: read
24+
25+
jobs:
26+
chromatic:
27+
name: Publish
28+
runs-on: ubuntu-latest
29+
timeout-minutes: 10
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
33+
with:
34+
fetch-depth: 0 # Chromatic needs full git history to find baselines
35+
persist-credentials: false
36+
37+
- name: Bootstrap
38+
uses: ./.github/actions/bootstrap
39+
40+
- name: Build Storybook
41+
run: bun run build-storybook
42+
43+
- name: Publish to Chromatic
44+
run: |
45+
bun run chromatic -- \
46+
--project-token="${{ secrets.CHROMATIC_PROJECT_TOKEN }}" \
47+
--storybook-build-dir=storybook-static \
48+
--only-changed \
49+
--exit-zero-on-changes \
50+
--auto-accept-changes=main

0 commit comments

Comments
 (0)