forked from metabase/metabase
-
Notifications
You must be signed in to change notification settings - Fork 2
75 lines (70 loc) · 2.44 KB
/
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Chromatic Storybook deployment
on:
push:
branches:
- "master"
pull_request:
types: [synchronize, labeled, unlabeled]
workflow_run:
workflows: [External Trigger Filter]
types: [completed]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
external-filter:
# 1. within the organization OR
# 2. fork
if: |
github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository ||
github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-22.04
timeout-minutes: 3
steps:
- run: |
if ${{ github.event.pull_request.head.repo.full_name == github.repository }}; then
echo 'Running Chromatic workflow within the organization.'
elif ${{ github.event.workflow_run.conclusion == 'success' }}; then
echo "Running Chromatic workflow for the external contributor. Thank you!"
fi
files-changed:
name: Check which files changed
runs-on: ubuntu-22.04
timeout-minutes: 3
outputs:
frontend_all: ${{ steps.changes.outputs.frontend_all }}
e2e_specs: ${{ steps.changes.outputs.e2e_specs }}
steps:
- uses: actions/checkout@v3
- name: Test which files changed
uses: dorny/[email protected]
id: changes
with:
token: ${{ github.token }}
filters: .github/file-paths.yaml
fe-chromatic:
needs: [files-changed, external-filter]
if: |
(needs.external-filter.result == 'success' && contains(github.event.pull_request.labels.*.name, 'chromatic')) ||
(github.ref_name == 'master' && needs.files-changed.outputs.frontend_all == 'true')
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Publish to Chromatic
uses: chromaui/action@v1
env:
PUBLISH_CHROMATIC: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
STORYBOOK_BUILD_TIMEOUT: 900000
if: env.PUBLISH_CHROMATIC != null
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}