-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (70 loc) · 2.37 KB
/
cdn-canary.yml
File metadata and controls
88 lines (70 loc) · 2.37 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
name: Deploy CDN Canary
on:
push:
branches:
- main
permissions:
contents: read
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
concurrency:
group: cdn-canary
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.node-version'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
env:
CDN_CHANNEL: canary
run: npm run build
- name: Build vendor CDN
env:
CDN_CHANNEL: canary
run: npm run build:vendor-cdn
- name: Build CDN assets
env:
CDN_CHANNEL: canary
run: npm run build:cdn-assets
- name: Check for bare imports
run: node tools/cdn/check-bare-imports.js
- name: Worker unit tests
run: cd tools/cdn && npx vitest run --config vitest.unit.config.js
- name: Upload canary to R2
env:
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
R2_ENDPOINT: ${{ secrets.R2_ENDPOINT }}
R2_BUCKET_NAME: ${{ secrets.R2_BUCKET_NAME }}
run: cd tools/cdn && node upload.js --version canary --force-vendor
- name: Deploy Worker
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_WORKERS_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: cd tools/cdn && npx wrangler deploy
- name: Purge Cloudflare cache
continue-on-error: true
run: |
curl -sf -X POST \
"https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE_ID }}/purge_cache" \
-H "Authorization: Bearer ${{ secrets.CLOUDFLARE_WORKERS_TOKEN }}" \
-H "Content-Type: application/json" \
-d '{"purge_everything":true}'
- name: Cache Playwright
uses: actions/cache@v5
with:
key: ${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json') }}
path: ~/.cache/ms-playwright
- name: Install Playwright
run: cd tools/cdn && npx playwright install chromium
- name: Post-deploy CDN smoke tests
run: cd tools/cdn && npx vitest run --config vitest.config.js