-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (57 loc) · 2.17 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
name: Publish to Chromatic
on:
push:
paths:
- 'src/**'
- '.github/workflows/chromatic.yml'
jobs:
chromatic-deployment:
runs-on: ubuntu-latest
steps:
- name: 'Git checkout'
uses: actions/checkout@v2
with:
fetch-depth: 0 # Required to retrieve git history
# Beginning of yarn setup, keep in sync between all workflows, see continous-integration.yml
- name: Use node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
- name: 'Use cached node_modules'
id: cache-modules
uses: actions/[email protected]
with:
path: '**/node_modules'
key: ${{ runner.os }}-v${{ matrix.node-version }}-node_modules-${{ hashFiles('yarn.lock', '**/package.json') }}
- name: 'Find location of global yarn cache'
id: yarn-cache
if: steps.cache-modules.outputs.cache-hit != 'true'
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: 'Cache global yarn cache'
uses: actions/[email protected]
if: steps.cache-modules.outputs.cache-hit != 'true'
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: 'Install dependency'
run: yarn install --frozen-lockfile
# End of yarn setup
# 👇 Checks if the branch is not main and runs Chromatic
- name: 'Publish to Chromatic'
if: github.ref != 'refs/heads/main'
uses: chromaui/action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
exitZeroOnChanges: true
# 👇 Checks if the branch is main and accepts all changes in Chromatic
- name: 'Publish to Chromatic and auto accept changes'
if: github.ref == 'refs/heads/main'
uses: chromaui/action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
autoAcceptChanges: true
exitZeroOnChanges: true