-
Notifications
You must be signed in to change notification settings - Fork 1
100 lines (97 loc) · 3.2 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Workflow name
name: "Chromatic"
# Event for the workflow
on:
pull_request:
types: [opened, reopened, synchronize]
push:
branches:
- main
# List of jobs
jobs:
optimize_ci:
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check_skip.outputs.skip }}
steps:
- name: Optimize CI
id: check_skip
uses: withgraphite/graphite-ci-action@main
with:
graphite_token: ${{ secrets.GRAPHITE_CI_OPTIMIZER_TOKEN }}
# JOB to run change detection
changes:
runs-on: ubuntu-latest
# Set job outputs to values from filter step
outputs:
ui: ${{ steps.filter.outputs.ui }}
studio: ${{ steps.filter.outputs.studio }}
steps:
- uses: actions/checkout@v4
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
ui:
- 'packages/components/**'
studio:
- 'apps/studio/**'
- 'packages/components/src/interfaces/**'
- 'packages/components/src/types/**'
ui:
needs: [changes, optimize_ci]
# Only run if the user is not a bot and has changes
if: ${{ !endsWith(github.actor , 'bot') && !endsWith(github.actor, '[bot]') && needs.changes.outputs.ui == 'true' && needs.optimize_ci.outputs.skip == 'false'}}
# Operating System
runs-on: ubuntu-latest
environment: staging
# Job steps
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for v4
- name: Setup
uses: ./.github/actions/setup
# 👇 Adds Chromatic as a step in the workflow
- name: Publish to Chromatic
uses: chromaui/action@latest
# Chromatic GitHub Action options
with:
workingDir: packages/components
storybookBaseDir: packages/components
projectToken: ${{ secrets.CHROMATIC_COMPONENTS_PROJECT_TOKEN }}
onlyChanged: true
exitOnceUploaded: true
autoAcceptChanges: main
# Skip running Chromatic on dependabot PRs
skip: dependabot/**
studio:
needs: [changes, optimize_ci]
# Only run if the user is not a bot and has changes
if: ${{ !endsWith(github.actor , 'bot') && !endsWith(github.actor, '[bot]') && needs.changes.outputs.studio == 'true' && needs.optimize_ci.outputs.skip == 'false' }}
# Operating System
runs-on: ubuntu-latest
environment: staging
# Job steps
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for v4
- name: Setup
uses: ./.github/actions/setup
- name: Build Isomer Components
run: npm run --workspace packages/components build
# 👇 Adds Chromatic as a step in the workflow
- name: Publish to Chromatic
uses: chromaui/action@latest
# Chromatic GitHub Action options
with:
workingDir: apps/studio
storybookBaseDir: apps/studio
projectToken: ${{ secrets.CHROMATIC_STUDIO_PROJECT_TOKEN }}
onlyChanged: true
exitOnceUploaded: true
autoAcceptChanges: main
# Skip running Chromatic on dependabot PRs
skip: dependabot/**