Merge pull request #1355 from nickgros/SWC-7064d #1505
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |