-
Notifications
You must be signed in to change notification settings - Fork 86
277 lines (233 loc) · 7.62 KB
/
ci.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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# The name of this GH action
name: CI
# Defines when this action should be run
on:
# Run on any Push
push:
branches-ignore:
- en
- en-staging
- en-abtest
- en-snapshot
- jp
- jp-partial
# Run for PRs on main and staging
pull_request:
branches: [main, staging, abtest]
jobs:
# The lint job checks that all content is sanitized,
# spell checked, and without any obvious dead links
lint:
# We run this on the latest ubuntu
runs-on: ubuntu-latest
timeout-minutes: 3
# We use node 14.X
strategy:
matrix:
node-version: [14.x]
# The following steps are performed for each lint job
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Lint the yaml files in ./content
uses: karancode/[email protected]
with:
yamllint_file_or_dir: ./content
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Lint the content
run: |
yarn install
yarn ci
# The test job ensures that the markdown and yaml compilers
# work according to specifiction
test:
# We run this on the latest ubuntu
runs-on: ubuntu-latest
timeout-minutes: 3
# We use node 14.X
strategy:
matrix:
node-version: [14.x]
# The following steps are performed for each lint job
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Run the test
run: |
yarn install
yarn test
- name: Send Slack notification
uses: Ilshidur/[email protected]
if: github.ref == 'refs/heads/main'
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_USERNAME: GitHub Actions
SLACK_AVATAR: "https://avatars3.githubusercontent.com/u/8659759?s=200&v=4"
with:
args: "Markdown passed linting and testing"
# The deploy task actually deploys any changes to the en branch
push-to-en:
# We run this on the latest ubuntu
runs-on: ubuntu-latest
timeout-minutes: 3
# Only run for the main branch
if: github.ref == 'refs/heads/main'
# We use node 14.X
strategy:
matrix:
node-version: [14.x]
# Requires the lint and test jobs to pass first
needs:
- lint
- test
# The following steps are performed for each lint job
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Compile the content
run: |
yarn install
yarn build
- name: Push compiled content
uses: s0/[email protected]
env:
REPO: self
BRANCH: en
FOLDER: compiled
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Trigger Netlify deployment"
uses: joelwmale/[email protected]
env:
WEBHOOK_URL: ${{ secrets.NETLIFY_BOXDEV_WEBHOOK }}
data: "{}"
- name: "Trigger Netlify deployment (Box.dev mirror)"
uses: joelwmale/[email protected]
env:
WEBHOOK_URL: ${{ secrets.NETLIFY_BOXDEV_MIRROR_WEBHOOK }}
data: "{}"
- name: Send Slack notification
uses: Ilshidur/[email protected]
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_USERNAME: GitHub Actions
SLACK_AVATAR: "https://avatars3.githubusercontent.com/u/8659759?s=200&v=4"
with:
args: "Pushed latest Markdown to `en` branch :rocket:"
- name: Send Slack notification
uses: Ilshidur/[email protected]
if: ${{ failure() }}
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_USERNAME: GitHub Actions
SLACK_AVATAR: "https://avatars3.githubusercontent.com/u/8659759?s=200&v=4"
with:
args: "Error running `deploy` job in OpenAPI CI"
# The deploy task actually deploys any changes to the en-staging branch
push-to-en-staging:
# We run this on the latest ubuntu
runs-on: ubuntu-latest
# Only run for the staging branch
if: github.ref == 'refs/heads/staging'
# We use node 14.X
strategy:
matrix:
node-version: [14.x]
# Requires the lint and test jobs to pass first
needs:
- lint
- test
# The following steps are performed for each lint job
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Compile the content
run: |
yarn install
yarn build
- name: Push compiled content
uses: s0/[email protected]
env:
REPO: self
BRANCH: en-staging
FOLDER: compiled
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Trigger Netlify deployment"
uses: joelwmale/[email protected]
env:
WEBHOOK_URL: ${{ secrets.NETLIFY_BOXDEV_STAGING_WEBHOOK }}
data: "{}"
- name: Send Slack notification
uses: Ilshidur/[email protected]
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_USERNAME: GitHub Actions
SLACK_AVATAR: "https://avatars3.githubusercontent.com/u/8659759?s=200&v=4"
with:
args: "Pushed latest Markdown to `en-staging` branch :rocket:"
- name: Send Slack notification
uses: Ilshidur/[email protected]
if: ${{ failure() }}
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_USERNAME: GitHub Actions
SLACK_AVATAR: "https://avatars3.githubusercontent.com/u/8659759?s=200&v=4"
with:
args: "Error running `deploy-staging` job in OpenAPI CI"
# The deploy task actually deploys any changes to the en-staging branch
push-to-en-abtest:
# We run this on the latest ubuntu
runs-on: ubuntu-latest
# Only run for the staging branch
if: github.ref == 'refs/heads/abtest'
# We use node 14.X
strategy:
matrix:
node-version: [14.x]
# Requires the lint and test jobs to pass first
needs:
- lint
- test
# The following steps are performed for each lint job
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Compile the content
run: |
yarn install
yarn build
- name: Push compiled content
uses: s0/[email protected]
env:
REPO: self
BRANCH: en-abtest
FOLDER: compiled
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Trigger Netlify deployment"
uses: joelwmale/[email protected]
env:
WEBHOOK_URL: ${{ secrets.NETLIFY_BOXDEV_ABTEST_WEBHOOK }}
data: "{}"
- name: Send Slack notification
uses: Ilshidur/[email protected]
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_USERNAME: GitHub Actions
SLACK_AVATAR: "https://avatars3.githubusercontent.com/u/8659759?s=200&v=4"
with:
args: "Pushed latest Markdown to `abtest` branch :rocket:"
- name: Send Slack notification
uses: Ilshidur/[email protected]
if: ${{ failure() }}
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_USERNAME: GitHub Actions
SLACK_AVATAR: "https://avatars3.githubusercontent.com/u/8659759?s=200&v=4"
with:
args: "Error running `deploy-abtest` job in OpenAPI CI"