-
Notifications
You must be signed in to change notification settings - Fork 23
47 lines (44 loc) · 1.56 KB
/
deploy-to-chromatic.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
name: 'Deploy Storybook to Chromatic'
env:
NODE_OPTIONS: '--max-old-space-size=4096'
on:
push:
branches:
- main
pull_request_target:
types: [labeled]
branches:
- main
jobs:
deploy-to-chromatic:
name: Deploy to Chromatic
runs-on: ubuntu-latest
steps:
- name: Check PR label
if: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.label.name != 'chromatic' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# The following script will cancel the rest of the job
run: |
gh run cancel ${{ github.run_id }}
gh run watch ${{ github.run_id }}
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
# Chromatic requires full git history to track changes
fetch-depth: 0
- uses: ./.github/actions/pnpm-setup-action
- name: Prebuild dependencies
# we technically only need to build the dependencies of SRC, but Nx doesn't expose an easy way to do that
run: pnpm nx run synapse-react-client:build
- name: Publish to Chromatic
uses: chromaui/action@v11
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
workingDir: packages/synapse-react-client
exitZeroOnChanges: true
exitOnceUploaded: true
autoAcceptChanges: 'main'
onlyChanged: true
buildScriptName: 'storybook:build'