-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathconfig.yml
218 lines (209 loc) · 6.26 KB
/
config.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
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
version: 2.1
orbs:
docker: circleci/docker@2.1.3
node: circleci/node@5.0.2
vault: contentful/vault@1
jobs:
build:
docker:
- image: cimg/node:lts-browsers
resource_class: xlarge
working_directory: ~/circleci-f36-build
steps:
- checkout
- vault/get-secrets:
template-preset: packages-read
- run: |
echo "//npm.pkg.github.com/:_authToken=${GITHUB_PACKAGES_READ_TOKEN}" > ~/.npmrc
echo "@contentful:registry=https://npm.pkg.github.com" >> ~/.npmrc
- attach_workspace:
at: ~/circleci-f36-build
- node/install-packages
- run:
name: Build packages
command: npm run-script build -- --force
- persist_to_workspace:
root: .
paths:
- packages/components/**/dist
- packages/core/dist
- packages/f36-docs-utils/dist
- packages/forma-36-react-components/dist
- packages/forma-36-tokens/dist
analyze_code:
docker:
- image: cimg/node:lts
resource_class: xlarge
working_directory: ~/circleci-f36-build
steps:
- checkout
- attach_workspace:
at: ~/circleci-f36-build
- node/install-packages
- run:
name: Prettier
command: npm run-script prettier:check
- run:
name: Lint
command: npm run-script lint
- run:
name: Check types
command: npm run-script tsc
test:
docker:
- image: cimg/node:lts
resource_class: xlarge
working_directory: ~/circleci-f36-build
steps:
- checkout
- attach_workspace:
at: ~/circleci-f36-build
- node/install-packages
- run:
name: Test
command: npm run-script test
check-links:
docker:
- image: cimg/node:lts-browsers
resource_class: xlarge
working_directory: ~/circleci-f36-build
steps:
- checkout
- attach_workspace:
at: ~/circleci-f36-build
- node/install-packages
- run:
name: Build Next.js website
command: npm run-script docs:next:build
- run:
name: Run production version of the website locally
command: npm run-script docs:next:start-prod
background: true
- run:
name: Wait for localhost:3000 to be ready
command: npx wait-on http://localhost:3000
- run:
name: Run links checker
command: npx blc http://localhost:3000 -ro --exclude "https://medium.com/contentful-design" --exclude "https://github.com/contentful/forma-36" --exclude "https://www.figma.com/@contentful"
deploy_chromatic:
docker:
- image: cimg/node:lts
resource_class: xlarge
working_directory: ~/circleci-f36-build
steps:
- checkout
- attach_workspace:
at: ~/circleci-f36-build
- node/install-packages
- run:
name: Storybook
command: npm run-script storybook:build
- run:
name: Chromatic
command: npx chromatic --only-changed --project-token=${CHROMATIC_PROJECT_TOKEN} --exit-zero-on-changes --storybook-build-dir ./dist-storybook --externals "scripts/.storybook/public/**"
release:
docker:
- image: cimg/node:lts
working_directory: ~/circleci-f36-build
resource_class: xlarge
steps:
- checkout
- vault/get-secrets:
template-preset: semantic-release
- run: |
echo "//npm.pkg.github.com/:_authToken=${GITHUB_PACKAGES_WRITE_TOKEN}" > ~/.npmrc
echo "@contentful:registry=https://npm.pkg.github.com" >> ~/.npmrc
- attach_workspace:
at: ~/circleci-f36-build
- add_ssh_keys:
fingerprints:
- 62:c1:53:b7:19:b8:35:4a:67:8c:58:c3:60:e0:68:11
- node/install-packages
- run: git config --global user.email ${GIT_AUTHOR_EMAIL}
- run: git config --global user.name ${GIT_AUTHOR_NAME}
- run:
name: Generate changelogrc
command: npm run-script changelog:gen
- run:
name: Generate packages changelogs
command: npx changeset version
- run:
name: Publish packages and create releases
command: |
npm run-script changeset:publish
changelog:
docker:
- image: cimg/node:lts
resource_class: xlarge
working_directory: ~/circleci-f36-build
steps:
- checkout
- vault/get-secrets:
template-preset: semantic-release
- run: |
echo "//npm.pkg.github.com/:_authToken=${GITHUB_PACKAGES_WRITE_TOKEN}" > ~/.npmrc
echo "@contentful:registry=https://npm.pkg.github.com" >> ~/.npmrc
- attach_workspace:
at: ~/circleci-f36-build
- add_ssh_keys:
fingerprints:
- 62:c1:53:b7:19:b8:35:4a:67:8c:58:c3:60:e0:68:11
- node/install-packages
- run: git config --global user.email ${GIT_AUTHOR_EMAIL}
- run: git config --global user.name ${GIT_AUTHOR_NAME}
- run:
name: Generate changelog files
command: npm run-script changelog:write
- run:
name: Commit changelog files
command: |
git add . && npm run-script pretty:quick
git diff --staged --quiet || git commit -am "docs: update changelog on repository and website" && git push origin ${CIRCLE_BRANCH}
workflows:
version: 2
f36-build:
jobs:
- build:
context:
- vault
- analyze_code:
requires:
- build
- test:
requires:
- build
- check-links:
requires:
- build
- deploy_chromatic:
requires:
- build
- analyze_code
- test
filters:
branches:
# Forked pull requests have CIRCLE_BRANCH set to pull/XXX
ignore: /pull\/[0-9]+/
- release:
requires:
- build
- analyze_code
- test
context:
- vault
filters:
branches:
only:
- main
f36-changelog:
triggers:
- schedule:
cron: '30 1 * * *'
filters:
branches:
only:
- main
jobs:
- changelog:
context:
- vault