-
Notifications
You must be signed in to change notification settings - Fork 2
114 lines (96 loc) · 3.55 KB
/
storybook.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# This GitHub action updates the Chromatic build everytime the Fractal
# documentation or the React UI library is updated.
name: Storybook
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
NODE_ENV: production
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
chromatic:
name: Deploying Fractal Storybook to Chromatic
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- if: github.event_name == 'pull_request' && startsWith(github.head_ref, 'renovate/')
name: Do not update Chromatic on Renovate PRs
run: echo "SKIP_CHROMATIC=1" >> $GITHUB_ENV
- if: env.SKIP_CHROMATIC != 1
name: Get changed files from Fractal components library
id: changed-files-specific
uses: tj-actions/changed-files@v37
with:
files: |
packages/fractal/**
package.json
tsconfig.json
yarn.lock
.yarnrc
.yarn/**
.gitignore
scripts/**
.github/workflows/quality.yml
.github/workflows/storybook.yml
- if: env.SKIP_CHROMATIC != 1 && steps.changed-files-specific.outputs.any_changed != 'true'
name: No need to update Chromatic
run: |
echo "There are no changes in Fractal components library."
echo "SKIP_CHROMATIC=1" >> $GITHUB_ENV
- if: env.SKIP_CHROMATIC != 1
uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn
- if: env.SKIP_CHROMATIC != 1
name: Installing dependencies
run: yarn install --immutable --immutable-cache
- if: env.SKIP_CHROMATIC != 1
name: Starting TurboRepo local cache server
uses: dtinth/setup-github-actions-caching-for-turbo@v1
- if: env.SKIP_CHROMATIC != 1
name: Setting up Git to access Freezer
env:
FREEZER_TOKEN: ${{ secrets.FREEZER_TOKEN }}
run: yarn run setup:freezer
- if: env.SKIP_CHROMATIC != 1 && github.event_name == 'push'
name: Waiting for security to pass
uses: lewagon/[email protected]
with:
ref: ${{ github.ref }}
check-name: Checking Yarn cache's integrity
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
- if: env.SKIP_CHROMATIC != 1 && github.event_name == 'push'
name: Waiting for quality to pass
uses: lewagon/[email protected]
with:
ref: ${{ github.ref }}
check-name: Checking code quality
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
- if: env.SKIP_CHROMATIC != 1 && github.event_name == 'push'
name: Building and publishing to Chromatic
env:
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_REACT_PROJECT_TOKEN }}
run: |
yarn workspace @snowball-tech/fractal build:chromatic --exit-zero-on-changes --exit-once-uploaded --no-interactive
- if: env.SKIP_CHROMATIC != 1 && github.event_name == 'pull_request'
name: Building and publishing to Chromatic with Snapshot testing
env:
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_REACT_PROJECT_TOKEN }}
run: |
yarn workspace @snowball-tech/fractal build:chromatic --no-interactive
- if: env.SKIP_CHROMATIC != 1
uses: actions/upload-artifact@v3
with:
name: Storybook build log
path: ./packages/fractal/build-storybook.log