-
-
Notifications
You must be signed in to change notification settings - Fork 2
614 lines (597 loc) · 17 KB
/
cd.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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
name: CI/CD
jobs:
# Stage 1: codacy, devskim, install
codacy:
name: Codacy
runs-on: ubuntu-latest
env:
DD_ENV: ci
services:
datadog-agent:
image: datadog/agent:latest
env:
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_HOSTNAME: none
DD_INSIDE_CI: true
ports:
- 8126:8126
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Analyze
uses: codacy/codacy-analysis-cli-action@master
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
format: sarif
gh-code-scanning-compat: true
max-allowed-issues: 2147483647
output: sarif/codacy.sarif
verbose: true
## rejecting SARIF, as there are more runs than allowed (22 > 20)
# - name: Upload SARIF
# if: always()
# uses: github/codeql-action/upload-sarif@main
# with:
# sarif_file: sarif/codacy.sarif
# wait-for-processing: true
devskim:
name: DevSkim
runs-on: ubuntu-latest
env:
DD_ENV: ci
- 8126:8126
permissions:
actions: read
contents: read
security-events: write
services:
datadog-agent:
image: datadog/agent:latest
env:
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_HOSTNAME: none
DD_INSIDE_CI: true
ports:
- 8126:8126
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Scan
uses: microsoft/DevSkim-Action@v1
- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: devskim-results.sarif
wait-for-processing: true
install:
name: Install
runs-on: ubuntu-latest
env:
DD_ENV: ci
services:
datadog-agent:
image: datadog/agent:latest
env:
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_HOSTNAME: none
DD_INSIDE_CI: true
ports:
- 8126:8126
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
cache: yarn
check-latest: true
node-version: 'lts/*'
- name: Install dependencies
run: yarn install --immutable
# Stage 2: prepack
prepack:
name: Prepack
needs: install
runs-on: ubuntu-latest
env:
DD_ENV: ci
services:
datadog-agent:
image: datadog/agent:latest
env:
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_HOSTNAME: none
DD_INSIDE_CI: true
ports:
- 8126:8126
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
cache: yarn
check-latest: true
node-version: 'lts/*'
- name: Install dependencies
run: yarn install --immutable
- name: Prepack
run: yarn run --require dd-trace/init prepack
env:
CLARITY_TAG: lm4m88gmix
CLOUD_PLATFORM: GitHub
CLOUD_PROVIDER: GitHub Pages
CLOUDWATCH_RUM_APPLICATION_ID: 8495b9c9-f57e-4395-9ca6-6c01862c107b
CLOUDWATCH_RUM_GUEST_ROLE_ARN: arn:aws:iam::787801101157:role/RUM-Monitor-us-west-2-787801101157-0860829251171-Unauth
CLOUDWATCH_RUM_IDENTITY_POOL_ID: us-west-2:f6379e5a-a304-4608-bf6d-b66f00a5d3fb
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_APPLICATION_ID: e29eb164-e193-4380-b512-ebd70bbfaeb6
DD_CLIENT_TOKEN: pubf0c07bd5003d0c4a65a9f129d9e83a3d
DD_ENV: prod
DD_PROFILING_ENABLED: true
DD_SERVICE: quisi.do
DD_VERSION: ${{ github.sha }}
DEPLOYMENT_ENVIRONMENT: live
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_SHA: ${{ github.sha }}
GOOGLE_ANALYTICS_TRACKING_ID: G-ZTQ6K5CVQS
IMAGEKIT_KEY: ${{ secrets.IMAGEKIT_KEY }}
PATREON_OAUTH_CLIENT_ID: J_6jrNJZNibHylSF83UVl9I4OHZYf67RAsU0s7_LnH1N5BKF-vgOyweF3KQLOKm1
PATREON_OAUTH_REDIRECT_URI: https://a.quisi.do/patreon/
SENTRY_ENVIRONMENT: production
WHOAMI: https://api.quisi.do/whoami
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: prepack
path: |
packages/*/.next/
packages/*/dist/
packages/*/out/
# Stage 3: lighthouse, prepublish, prepublish-applications
lighthouse:
name: Lighthouse
needs: prepack
runs-on: ubuntu-latest
env:
DD_ENV: ci
services:
datadog-agent:
image: datadog/agent:latest
env:
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_HOSTNAME: none
DD_INSIDE_CI: true
ports:
- 8126:8126
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: prepack
path: packages/
- name: Setup Node
uses: actions/setup-node@v3
with:
cache: yarn
check-latest: true
node-version: 'lts/*'
- name: Install dependencies
run: yarn install --immutable
- name: Audit
run: yarn packages/next run lighthouse:report:production
- name: Validate
run: yarn packages/next run postlighthouse
- name: Upload report
if: always()
uses: actions/upload-artifact@v3
with:
name: lighthouse
path: |
packages/*/lighthouse.report.*
packages/*/lighthouse-*.devtoolslog.json
packages/*/lighthouse-*.trace.json
prepublish:
name: Prepublish
needs: prepack
runs-on: ubuntu-latest
env:
DD_ENV: ci
services:
datadog-agent:
image: datadog/agent:latest
env:
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_HOSTNAME: none
DD_INSIDE_CI: true
ports:
- 8126:8126
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: prepack
path: packages/
- name: Setup Node
uses: actions/setup-node@v3
with:
cache: yarn
check-latest: true
node-version: 'lts/*'
- name: Install dependencies
run: yarn install --immutable
- name: Prepublish
run: yarn run --require dd-trace/ci/init prepublish
env:
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_CIVISIBILITY_AGENTLESS_ENABLED: true
DD_ENV: ci
DD_SERVICE: quisi.do
# Run prepublish on applications, because prepublish won't be triggered for
# applications by the publish step.
prepublish-applications:
name: Prepublish applications
needs: prepack
runs-on: ubuntu-latest
env:
DD_ENV: ci
services:
datadog-agent:
image: datadog/agent:latest
env:
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_HOSTNAME: none
DD_INSIDE_CI: true
ports:
- 8126:8126
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: prepack
path: packages/
- name: Setup Node
uses: actions/setup-node@v3
with:
cache: yarn
check-latest: true
node-version: 'lts/*'
- name: Install dependencies
run: yarn install --immutable
- name: Prepublish quisi.do
run: yarn packages/next run prepublish
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: prepublish-applications
path: packages/*/jest/
# Stage 4: github-pages, npm, sentry-release
datadog-sourcemaps:
name: Datadog sourcemaps
needs: [lighthouse, prepublish-applications]
runs-on: ubuntu-latest
env:
DD_ENV: ci
services:
datadog-agent:
image: datadog/agent:latest
env:
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_HOSTNAME: none
DD_INSIDE_CI: true
ports:
- 8126:8126
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: prepack
path: packages/
- name: Install dependencies
run: yarn install --immutable
- name: Upload Datadog sourcemaps
run: yarn packages/next run datadog:sourcemaps
env:
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
RELEASE_VERSION: ${{ github.sha }}
github-pages:
name: GitHub Pages
needs: [lighthouse, prepublish-applications]
runs-on: ubuntu-latest
env:
DD_ENV: ci
services:
datadog-agent:
image: datadog/agent:latest
env:
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_HOSTNAME: none
DD_INSIDE_CI: true
ports:
- 8126:8126
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: prepack
path: packages/
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
clean: true
folder: packages/next/out/
single-commit: true
npm:
name: NPM
needs: [prepack, prepublish]
runs-on: ubuntu-latest
env:
DD_ENV: ci
services:
datadog-agent:
image: datadog/agent:latest
env:
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_HOSTNAME: none
DD_INSIDE_CI: true
ports:
- 8126:8126
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: prepack
path: packages/
- name: Setup Node
uses: actions/setup-node@v3
with:
cache: yarn
check-latest: true
node-version: 'lts/*'
- name: Install dependencies
run: yarn install --immutable
- name: Publish
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: >
yarn config set npmAuthToken $NPM_AUTH_TOKEN;
yarn run publish;
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: npm
path: packages/*/jest/
sentry-release:
name: Sentry release
needs: [lighthouse, prepublish-applications]
runs-on: ubuntu-latest
env:
DD_ENV: ci
services:
datadog-agent:
image: datadog/agent:latest
env:
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_HOSTNAME: none
DD_INSIDE_CI: true
ports:
- 8126:8126
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: prepack
path: packages/
- name: Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_LOG_LEVEL: info
SENTRY_ORG: quisido
SENTRY_PROJECT: quisi-do
with:
environment: production
sourcemaps: build
version: ${{ github.sha }}
# Stage 5: cloudflare-purge, github-packages, wrangler-deploy-*
cloudflare-purge:
name: Cloudflare purge
needs: github-pages
runs-on: ubuntu-latest
env:
DD_ENV: ci
services:
datadog-agent:
image: datadog/agent:latest
env:
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_HOSTNAME: none
DD_INSIDE_CI: true
ports:
- 8126:8126
steps:
- name: Purge Cloudflare files
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_PURGE_API_TOKEN }}
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
run: >
curl \
--data '{
"files": [
"https://quisi.do",
"https://quisi.do/index.html"
]
}' \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type:application/json" \
--request POST \
"https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/purge_cache"
github-packages:
name: GitHub Packages
needs: npm
runs-on: ubuntu-latest
env:
DD_ENV: ci
permissions:
contents: read
packages: write
services:
datadog-agent:
image: datadog/agent:latest
env:
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_HOSTNAME: none
DD_INSIDE_CI: true
ports:
- 8126:8126
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: prepack
path: packages/
- name: Setup Node
uses: actions/setup-node@v3
with:
cache: yarn
check-latest: true
node-version: 'lts/*'
registry-url: 'https://npm.pkg.github.com'
scope: '@${{ github.repository_owner }}'
- name: Install dependencies
run: yarn install --immutable
- name: Publish
env:
NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
yarn config set npmAuthToken $NPM_AUTH_TOKEN;
yarn config set \
npmScopes.${{ github.repository_owner }}.npmPublishRegistry \
'https://npm.pkg.github.com';
yarn run publish;
wrangler-deploy-authn:
name: Wrangler deploy Authentication
needs: [lighthouse, npm, prepublish-applications]
runs-on: ubuntu-latest
env:
DD_ENV: ci
services:
datadog-agent:
image: datadog/agent:latest
env:
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_HOSTNAME: none
DD_INSIDE_CI: true
ports:
- 8126:8126
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
cache: yarn
check-latest: true
node-version: 'lts/*'
- name: Install dependencies
run: yarn install --immutable
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: prepack
path: packages/
- name: Deploy
run: yarn packages/authn run production:deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_EDIT_WORKERS_API_TOKEN }}
wrangler-deploy-cloudflare-analytics:
name: Wrangler deploy Cloudflare Analytics
needs: [lighthouse, npm, prepublish-applications]
runs-on: ubuntu-latest
env:
DD_ENV: ci
services:
datadog-agent:
image: datadog/agent:latest
env:
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_HOSTNAME: none
DD_INSIDE_CI: true
ports:
- 8126:8126
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
cache: yarn
check-latest: true
node-version: 'lts/*'
- name: Install dependencies
run: yarn install --immutable
- name: Deploy
run: yarn packages/cloudflare-analytics run deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_EDIT_WORKERS_API_TOKEN }}
# Stage 6: neuralegion
neuralegion:
name: NeuraLegion
needs: cloudflare-purge
runs-on: ubuntu-latest
env:
DD_ENV: ci
services:
datadog-agent:
image: datadog/agent:latest
env:
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_HOSTNAME: none
DD_INSIDE_CI: true
ports:
- 8126:8126
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Scan
continue-on-error: true
# id: scan
uses: NeuraLegion/run-scan@release
with:
api_token: ${{ secrets.NEURALEGION_TOKEN }}
name: GitHub SHA - ${{ github.sha }}
crawler_urls: |
["https://quisi.do/"]
discovery_types: |
["crawler"]
# - name: Wait for breakpoint
# continue-on-error: true
# uses: NeuraLegion/wait-for@release
# with:
# api_token: ${{ secrets.NEURALEGION_TOKEN }}
# code_scanning_alerts: true
# github_token: ${{ secrets.GITHUB_TOKEN }}
# scan: ${{ steps.scan.outputs.id }}
# timeout: 600
# wait_for: any
on:
push:
branches: [main]
workflow_dispatch: