-
Notifications
You must be signed in to change notification settings - Fork 350
49 lines (44 loc) · 1.89 KB
/
storybook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Publish Storybook to Chromatic
# See: https://www.chromatic.com/docs/setup-turbosnap/#github-pull_request-triggers
on:
workflow_dispatch:
# Other Khan Academy repositories use this trigger for the chromaui/action
# and it appears to work-ish, so we'll use the same. If it starts to break,
# review the above URL to see how to fix it.
pull_request:
push:
branches: [main]
# When a new revision is pushed to a PR, cancel all in-progress CI runs for that
# PR. See https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
chromatic:
name: Publish Storybook to Chromatic
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [20.x]
steps:
# chromaui/@action doesn't work with shallow checkouts which is the
# default for actions/checkout so we need to force it to checkout
# more stuff.
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install & cache node_modules
uses: ./.github/actions/shared-node-cache
with:
node-version: ${{ matrix.node-version }}
- name: Publish to Chromatic for visual testing
uses: chromaui/action@v11
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_APP_CODE }}
autoAcceptChanges: "main"
onlyStoryFiles: "**/*regression.stories.tsx"
# NOTE: We cannot enable `onlyChanged` because it is
# incompatible with `onlyStoryFiles` which we use above.
# onlyChanged: true # Enable TurboSnap!