-
Notifications
You must be signed in to change notification settings - Fork 7
145 lines (118 loc) · 3.74 KB
/
pull-request.yml
File metadata and controls
145 lines (118 loc) · 3.74 KB
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Pull Request
on:
pull_request:
paths-ignore:
- '.changeset/**'
- '.husky/**'
concurrency:
group: ci-pull-request=${{github.ref}}-1
cancel-in-progress: true
permissions:
contents: read
issues: write
pull-requests: write
statuses: write
# Note: Canary publishing is handled by publish.yml workflow
jobs:
# This job exists only to satisfy branch protection rules that expect this check name
# The actual publishing is done in publish.yml
build-canary-status:
name: 'Build & canary release'
runs-on: ubuntu-latest
steps:
- name: Publishing handled by publish.yml
run: echo "Canary publishing is handled by the Publish workflow (publish.yml)"
tests:
name: 'Tests & lint'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update Corepack
run: npm i -g corepack@latest
- name: Enable Corepack (pre)
run: corepack enable
- name: Prepare pnpm (pre)
run: corepack prepare pnpm@10.14.0 --activate
- uses: actions/cache@v4
name: Download eslint cache
with:
path: |
**/.eslintcache
key: ${{ runner.os }}-eslint
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Enable Corepack
run: corepack enable
- name: Prepare pnpm
run: corepack prepare pnpm@10.14.0 --activate
- name: Install dependencies
run: pnpm install
- name: Run the lint
run: pnpm lint
- name: Run the tests
run: pnpm test
deploy-chromatic:
name: 'Prepare Storybook for review & tests'
runs-on: ubuntu-latest
environment:
name: Chromatic staging
url: ${{ steps.publish_chromatic.outputs.url }}
env:
CHROMATIC_RETRIES: 5
LOG_LEVEL: 'error'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Update Corepack
run: npm i -g corepack@latest
- name: Enable Corepack (pre)
run: corepack enable
- name: Prepare pnpm (pre)
run: corepack prepare pnpm@10.14.0 --activate
- uses: actions/cache@v4
name: Download storybook cache
with:
path: |
**/node_modules/.cache
key: ${{ runner.os }}-storybook-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-storybook
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Enable Corepack
run: corepack enable
- name: Prepare pnpm
run: corepack prepare pnpm@10.14.0 --activate
- name: Install dependencies
run: pnpm install
- name: Publish to Chromatic
id: publish_chromatic
uses: chromaui/action@v11
with:
exitZeroOnChanges: true
exitOnceUploaded: true
onlyChanged: true
debug: true
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
- name: Comment PR
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const setMessage = require('${{ github.workspace }}/scripts/ci/set-message.cjs')
await setMessage({
header: "## 🧪 Storybook is successfully deployed!",
body: `
- 👀 Review changes: ${{ steps.publish_chromatic.outputs.url }}
- 👨🎨 Preview storybook: ${{ steps.publish_chromatic.outputs.storybookUrl }}
`,
github,
repo: context.repo,
prNumber: context.payload.pull_request.number
})