-
Notifications
You must be signed in to change notification settings - Fork 200
88 lines (80 loc) · 2.89 KB
/
vrt.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
name: Visual regression testing
on:
push:
branches:
- main
pull_request:
# the closed event type gives us the head_ref (the name of the branch being merged into main)
types:
- closed
# for PRs merging into the below branches
branches:
- main
- spectrum_two
- s2-foundations-redux
workflow_dispatch:
workflow_call:
inputs:
skip:
description: "Skip running VRT"
required: false
type: boolean
default: false
outputs:
storybook-url:
description: "URL of the published Storybook"
value: ${{ jobs.vrt.outputs.storybook-url }}
permissions:
contents: read
pull-requests: write
jobs:
vrt:
# if the branch being merged is a dependabot branch or a changeset release, skip everything in this workflow
if: ${{!startsWith(github.head_ref, 'dependabot') && !startsWith(github.head_ref, 'changeset-release') }}
name: Chromatic
runs-on: ubuntu-latest
timeout-minutes: 20
outputs:
storybook-url: ${{ steps.chromatic.outputs.storybookUrl != 'undefined' && steps.chromatic.outputs.storybookUrl || '' }}
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node LTS version
uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
- name: Enable Corepack
run: corepack enable
## --- YARN CACHE --- ##
- name: Check for cached dependencies
continue-on-error: true
id: cache-dependencies
uses: actions/cache@v4
with:
path: |
.cache/yarn
node_modules
key: ubuntu-latest-node20-${{ hashFiles('yarn.lock') }}
## --- INSTALL --- ##
- name: Install dependencies
shell: bash
run: yarn install --immutable
- name: Publish to Chromatic
id: chromatic
uses: chromaui/action@latest
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
buildScriptName: ci:storybook
storybookConfigDir: .storybook
storybookBaseDir: .storybook
exitOnceUploaded: true
onlyChanged: true
traceChanged: true
untraced: ".github/actions/*/package.json site/package.json generator/package.json"
diagnostics: true
autoAcceptChanges: "main"
# Lets VRT pass without running so as not to waste snapshots
skip: ${{ inputs.skip }}