2022-03-15 13:50:42 +01:00
|
|
|
name: Chromatic
|
|
|
|
|
2022-06-22 14:32:45 +02:00
|
|
|
on:
|
|
|
|
push:
|
2024-08-13 15:08:09 +02:00
|
|
|
branches:
|
|
|
|
- "main"
|
|
|
|
- "rc"
|
|
|
|
- "hotfix-rc"
|
|
|
|
pull_request_target:
|
|
|
|
types: [opened, synchronize]
|
2022-03-15 13:50:42 +01:00
|
|
|
|
|
|
|
jobs:
|
2024-08-13 15:08:09 +02:00
|
|
|
check-run:
|
|
|
|
name: Check PR run
|
|
|
|
uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main
|
2024-08-22 16:54:23 +02:00
|
|
|
|
2022-03-15 13:50:42 +01:00
|
|
|
chromatic:
|
|
|
|
name: Chromatic
|
2024-02-08 21:56:39 +01:00
|
|
|
runs-on: ubuntu-22.04
|
2024-08-13 15:08:09 +02:00
|
|
|
needs: check-run
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
pull-requests: write
|
2022-03-15 13:50:42 +01:00
|
|
|
|
|
|
|
steps:
|
2024-08-13 15:08:09 +02:00
|
|
|
- name: Check out repo
|
2024-10-17 16:45:49 +02:00
|
|
|
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
|
2023-10-05 00:01:44 +02:00
|
|
|
with:
|
2024-08-13 15:08:09 +02:00
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
2023-10-05 00:01:44 +02:00
|
|
|
fetch-depth: 0
|
|
|
|
|
2024-08-13 15:08:09 +02:00
|
|
|
- name: Get Node version
|
2023-10-04 18:23:40 +02:00
|
|
|
id: retrieve-node-version
|
|
|
|
run: |
|
|
|
|
NODE_NVMRC=$(cat .nvmrc)
|
|
|
|
NODE_VERSION=${NODE_NVMRC/v/''}
|
|
|
|
echo "node_version=$NODE_VERSION" >> $GITHUB_OUTPUT
|
|
|
|
|
2022-03-15 13:50:42 +01:00
|
|
|
- name: Set up Node
|
2024-09-24 17:35:01 +02:00
|
|
|
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
|
2022-03-15 13:50:42 +01:00
|
|
|
with:
|
2023-10-04 18:23:40 +02:00
|
|
|
node-version: ${{ steps.retrieve-node-version.outputs.node_version }}
|
2022-03-15 13:50:42 +01:00
|
|
|
|
2024-08-13 15:08:09 +02:00
|
|
|
- name: Cache NPM
|
2022-03-15 13:50:42 +01:00
|
|
|
id: npm-cache
|
2024-10-17 16:45:49 +02:00
|
|
|
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
|
2022-03-15 13:50:42 +01:00
|
|
|
with:
|
|
|
|
path: "~/.npm"
|
|
|
|
key: ${{ runner.os }}-npm-chromatic-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
|
|
|
|
- name: Install Node dependencies
|
|
|
|
run: npm ci
|
2023-10-04 18:23:40 +02:00
|
|
|
|
2024-08-13 15:08:09 +02:00
|
|
|
# Manually build the Storybook to resolve a bug related to TurboSnap
|
2023-05-26 15:58:06 +02:00
|
|
|
- name: Build Storybook
|
|
|
|
run: npm run build-storybook:ci
|
2022-03-15 13:50:42 +01:00
|
|
|
|
|
|
|
- name: Publish to Chromatic
|
2024-10-17 16:45:49 +02:00
|
|
|
uses: chromaui/action@bbbf288765438d5fd2be13e1d80d542a39e74108 # v11.12.1
|
2022-03-15 13:50:42 +01:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
|
2023-05-26 15:58:06 +02:00
|
|
|
storybookBuildDir: ./storybook-static
|
2022-03-15 13:50:42 +01:00
|
|
|
exitOnceUploaded: true
|
|
|
|
onlyChanged: true
|
2023-09-14 18:31:48 +02:00
|
|
|
externals: "[\"libs/components/**/*.scss\", \"libs/components/**/*.css\", \"libs/components/tailwind.config*.js\"]"
|