Repository navigation
570 lines (515 loc) · 26.5 KB
/
Copy pathdeploy.yml
File metadata and controls
570 lines (515 loc) · 26.5 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
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
name: Deploy
on:
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
jobs:
quality:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm -r lint
- name: Type check
run: pnpm -r typecheck
- name: Test
run: pnpm -r test
# Deliberately non-blocking. The report answers a question about an external
# service: does the public program page a class's `homepageUri` points at
# still answer. A 404 there does not break the wallet — Google rejects the
# class it reviews, days later, and that is where it should be fixed.
# Failing this step would instead block every wallet deploy for something
# outside the wallet, and the fix would be to make the step go away.
#
# The report is in the log either way, and a `BLOCK` on the program page is
# the finding worth reading. `continue-on-error` is here rather than relied
# on by accident.
#
# It stays non-blocking because the report asks a question about an external
# service, and a 404 on the program page does not break the wallet — Google
# rejects the class it reviews, days later, and that is where it should be
# fixed. Blocking here would hold every wallet deploy for something outside
# the wallet, and the tempting fix would be to delete the step.
#
# `main` does exit non-zero on a `BLOCK`, so this gate *could* block. An
# earlier version of this comment claimed the script set no exit code at all,
# and that claim was wrong — it was wrong because of a bug, not by design:
# the report read `apps/gateway/.dev.vars` unguarded, that file is gitignored,
# and CI has never had it, so every deploy threw `ENOENT`, exited 1 having
# printed nothing, and `continue-on-error` hid the stack trace where a report
# should have been. The step had never once produced a report in CI.
#
# Read today it degrades to `unknown` instead, which is the contract the
# script states for itself: it reports `unknown` rather than guessing when it
# cannot see a fact. On a runner with no database it will mostly say unknown —
# the checks that still report are the ones that need neither a database nor
# a Cloudflare token.
- name: Wallet readiness report
run: pnpm wallet:readiness
continue-on-error: true
# Populate the event schema registry, before anything that reads it is published.
#
# ## Why this is a job and not a step inside `deploy-gateway`
#
# The registry is shared state: `gateway`, `customer`, `growth`, `communication`
# and `automation` all bind the same `SCHEMA_REGISTRY` namespace, and
# `workers/customer` calls `validate` on a live route. A step inside the gateway
# job would run *after* the worker matrix, so the first deploy following this
# change would publish workers against the empty namespace they already read
# today. Both deploy jobs therefore depend on this one, and the invariant is
# "no Worker is ever published against an empty registry" rather than "the
# gateway is published against a populated one".
#
# ## Why it runs BEFORE the deploys, not after
#
# Two reasons, and the second is the one that decides it.
#
# 1. There is a window either way, and only one of the two windows is a correct
# answer. Publishing first leaves a gap in which the freshly deployed gateway
# answers `404 EVENT_TYPE_UNKNOWN` for every real event type, because
# `getSchema` returns `null` against an empty namespace. Populating first
# means the first request the new gateway ever serves already has its
# schemas. (KV is eventually consistent — up to 60s between locations — so a
# brief window of 404s remains possible on the very first deploy. It is
# bounded and self-healing; the alternative window is the permanent one that
# is being closed here.)
# 2. Failure has to be able to stop the deploy. After the deploy, a failed
# registration leaves a published gateway reading an empty registry and a
# green build — which is precisely how this bug survived a deploy already:
# nothing failed, so nothing was investigated. Before the deploy, a failure
# means the previous version keeps serving and CI is red.
#
# ## Why the failure is allowed to block
#
# No `continue-on-error`, unlike the wallet readiness report two jobs up. That
# report answers a question about an external service and failing it would
# block every deploy for something outside the deploy. This step IS the deploy:
# a registry that silently stays empty reproduces the defect this job exists
# to fix, and the whole design premise is that an empty registry must never
# again be indistinguishable from a successful one.
#
# ## Why the payload is generated rather than committed
#
# `packages/schema-registry/src/index.ts` is the source of truth for the
# schemas. A committed snapshot would be a second copy that drifts silently and
# produces a registry that looks populated and validates nothing. The script
# calls the same `registerAllSchemas` a Worker would call, so the keys
# published are the keys `validate` reads.
#
# ## Credentials
#
# The existing `CLOUDFLARE_API_TOKEN`, reused rather than a second token. It
# already authenticates every `wrangler deploy` in this workflow, so there is
# one secret to rotate and one blast radius to reason about.
#
# It does need one capability the deploys may not currently exercise: writing
# to Workers KV (`Account / Workers KV Storage / Edit`). A token scoped only to
# `Workers Scripts` will fail here with a permission error naming the scope —
# loudly, and before anything is deployed. That is the correct direction to
# fail in, and the fix is granting that scope on this same token rather than
# minting a narrower second one.
# Refuse to deploy code against a schema this repository has not verified.
#
# ## Why it is a job and not a step inside one of the deploys
#
# Four jobs publish: `deploy-workers`, `deploy-gateway`, `deploy-dashboard`,
# `deploy-customer-web`. A step inside any one of them runs *after* that job
# has already published, so a failing check would leave a deployed worker and a
# red build — which is how the current state survived: nothing ran
# `drizzle-kit migrate` on any deploy, `drizzle.__drizzle_migrations` in
# production records four of nine migrations, and every deploy was green
# throughout. A gate that can only report after the fact is a postmortem.
#
# It is not a step inside `deploy-workers` either: that is a matrix of eight,
# so the check would run eight times, and a failure would block one leg rather
# than all four deploys. Four `needs:` entries make the invariant explicit —
# nothing is published against an unverified schema.
#
# ## Why it runs before the deploys
#
# Same argument as `register-schemas` directly above, and for a stronger
# reason. A registry left empty is a namespace that fills in on the next
# deploy. A schema left behind is code that is already serving requests
# against columns that do not exist. Failing after the deploy would mean
# publishing the broken version and *then* finding out, which is strictly
# worse than the previous version continuing to serve with a red build.
#
# ## Why it is allowed to block
#
# No `continue-on-error`, unlike the wallet readiness report above. That one
# asks an informational question about an external service — does the public
# program page answer — and nothing happens automatically on the answer, so
# blocking every deploy for it would cost more than it caught. This step is not
# a report. Its whole claim is "the target schema matches the code being
# published", and a deploy that proceeds without that confirmation is the exact
# failure this exists to prevent. A green build that never checked is what let
# production drift for nine migrations unnoticed.
#
# ## Why it fails closed on an unreachable database
#
# `runGate` has no third state: "I could not verify" is a failure, not a pass.
# This is the deliberate opposite of the readiness report, which degrades to
# `unknown` because it reports about an external service and its question is
# informative. A safety interlock that can answer "I could not tell" passes
# whenever the network has a bad minute, which is to say it passes whenever it
# is most convenient to pass. The reasoning is in the script's header, next to
# the code, because it is counterintuitive enough that someone will eventually
# try to soften it.
#
# ## Credentials
#
# The existing `secrets.DATABASE_URL`, reused rather than a second secret. The
# workers hold it anyway, so minting another would add a thing to provision and
# rotate without removing the write credential from CI — the marginal benefit
# is small and the operational cost is real.
#
# The gate only issues SELECTs, and it puts the session itself in read-only
# mode (`SET default_transaction_read_only = on`, verified with `SHOW` and the
# connection dropped if the server does not honour it), so PostgreSQL refuses
# writes for this script rather than trusting it not to make them. Verified
# against the development database: both `CREATE TABLE` and an `INSERT` into
# `drizzle.__drizzle_migrations` are rejected with "cannot execute ... in a
# read-only transaction".
#
# That is enforced by the *script*, though, not by the credential. A dedicated
# read-only Postgres role would make it independent of the script, and is the
# right hardening; it is not a prerequisite because the secret is already
# scoped to this one workflow and the session guard is server-enforced.
migration-drift:
needs: [quality]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
# Required: `pg` is resolved relative to `packages/db/package.json`, so the
# workspace has to be installed even though nothing is built.
- name: Install dependencies
run: pnpm install --frozen-lockfile
# The committed baseline has to be the one inspection produced.
#
# This is what stops the baseline being grown by hand to make the gate pass:
# adding an entry requires the migration to actually be applied to the
# target database, because this step re-derives the baseline from the live
# catalog and diffs it byte for byte. A hand-written entry that the schema
# does not support makes this step fail, and the failure names the command
# that fixes it.
#
# Deliberately a separate step from the gate below. They answer different
# questions — "is the baseline honest?" and "does the schema match the
# code?" — and collapsing them would mean a stale baseline was reported as
# schema drift, which sends someone to run migrations they do not need.
- name: Verify the committed baseline matches the target schema
run: pnpm db:drift:baseline
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
- name: Migration drift gate
run: pnpm db:drift
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
register-schemas:
needs: [quality]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
# Required, not incidental: the payload script imports the schema registry
# source, which imports `ajv`.
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Publish the event schemas to SCHEMA_REGISTRY
run: |
node --experimental-strip-types \
packages/schema-registry/scripts/publish-registry-payload.ts \
"${RUNNER_TEMP}/schema-registry.json"
npx --yes wrangler kv bulk put "${RUNNER_TEMP}/schema-registry.json" \
--binding SCHEMA_REGISTRY \
--config apps/gateway/wrangler.jsonc \
--remote
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
# `--remote` above is load-bearing and not the default: without it wrangler
# writes to a local store, prints `Success!`, and leaves production just as
# empty as before. `--binding` plus `--config` rather than
# `--namespace-id` so the namespace this job writes to is read from the same
# config that publishes the binding — there is no second copy of the id in
# this file to drift.
deploy-workers:
needs: [quality, register-schemas, migration-drift]
runs-on: ubuntu-latest
# Nine publishes in sequence, where the matrix ran them in parallel and
# finished inside the same fifteen minutes.
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
# One runner for all nine workers, not nine runners for one worker each.
#
# The matrix was nine boots of a runner, nine checkouts and nine
# `pnpm install --frozen-lockfile` of the same monorepo, to run nine
# `wrangler deploy` calls that each take seconds. Runner minutes are
# billed per runner, so the parallel matrix cost nine times the
# sequential job for the same result.
#
# It also ran with `fail-fast: false`, which meant a worker that failed
# to publish did not stop the others: the platform could end up with a
# new `growth` and an old `identity`. Deploying in order stops at the
# first failure, which is a consistent state rather than a mixed one.
#
# The gateway is still published last, and for the same reason as
# before: it binds to every worker here, and Cloudflare refuses to
# publish a Worker whose binding names a Worker that does not exist yet.
# That ordering lives in this file's `needs`, not in the matrix, so
# removing the matrix does not touch it.
- name: Deploy the workers
run: |
set -euo pipefail
deploy_worker() {
local service="$1"
local dir="$2"
local -a args=()
# `DATABASE_URL` is a connection string with a password in it, so it
# arrives as a `--var` from the secret rather than living in a
# `wrangler.jsonc` that is committed.
#
# **Six** workers read it, not two. Four of them call
# `createDb(c.env.DATABASE_URL)` — `analytics`, `automation`,
# `communication` and `growth` — and `customer` takes it the same way.
# Listing only `identity` and `wallet` left the other four depending on a
# binding that this job never sets, which is not something any local run
# can show: the deploy is the only place the omission exists.
#
# `wrangler deploy` keeps bindings a previous deploy set, so a worker that
# had the var once keeps working while a worker that never did returns
# `500` from `set_config` on the first query. That is what
# `/v1/communication/templates` was doing.
#
# The list is the `createDb(c.env.DATABASE_URL)` set plus `identity`, and
# it is asserted by `deploy-bindings.contract.test.ts` so a seventh worker
# cannot join that group without the deploy being taught about it.
# An array, and each element quoted when it is added.
#
# A secret is an opaque string, and a connection string contains
# `&` — which a shell reads as "run the next thing in the
# background" unless it is quoted. Building one string and letting
# it word-split is how that turns into a deploy that publishes
# without its database.
case "$service" in
identity)
args+=(--var JWT_SECRET:"$JWT_SECRET")
args+=(--var DATABASE_URL:"$DATABASE_URL")
;;
communication)
args+=(--var WHATSAPP_PHONE_ID:"$WHATSAPP_PHONE_ID")
args+=(--var WHATSAPP_TOKEN:"$WHATSAPP_TOKEN")
args+=(--var WHATSAPP_VERIFY_TOKEN:"$WHATSAPP_VERIFY_TOKEN")
args+=(--var DATABASE_URL:"$DATABASE_URL")
# The VAPID identity this worker signs push deliveries with.
# The public half is public by design — the browser subscribes
# with it — and the private half is the difference between "a
# push service accepted this message" and "anyone could send
# this customer a message".
args+=(--var VAPID_PUBLIC_KEY:"$VAPID_PUBLIC_KEY")
args+=(--var VAPID_PRIVATE_KEY:"$VAPID_PRIVATE_KEY")
args+=(--var VAPID_SUBJECT:"$VAPID_SUBJECT")
;;
analytics | automation | customer | growth | wallet)
args+=(--var DATABASE_URL:"$DATABASE_URL")
;;
esac
echo "::group::Deploy $service"
( cd "$dir" && npx --yes wrangler deploy "${args[@]}" )
echo "::endgroup::"
}
deploy_worker identity workers/identity
deploy_worker customer workers/customer
deploy_worker growth workers/growth
deploy_worker analytics workers/analytics
deploy_worker automation workers/automation
deploy_worker communication workers/communication
deploy_worker compliance workers/compliance
deploy_worker wallet workers/wallet
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
VAPID_PUBLIC_KEY: ${{ secrets.VAPID_PUBLIC_KEY }}
VAPID_PRIVATE_KEY: ${{ secrets.VAPID_PRIVATE_KEY }}
VAPID_SUBJECT: ${{ secrets.VAPID_SUBJECT }}
# The secrets arrive through the environment, not through the shell
# parser. A value interpolated into a command line is a value the
# shell will interpret.
JWT_SECRET: ${{ secrets.JWT_SECRET }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
WHATSAPP_PHONE_ID: ${{ secrets.WHATSAPP_PHONE_ID }}
WHATSAPP_TOKEN: ${{ secrets.WHATSAPP_TOKEN }}
WHATSAPP_VERIFY_TOKEN: ${{ secrets.WHATSAPP_VERIFY_TOKEN }}
# The gateway binds to identity, customer, growth, analytics, automation,
# communication, compliance and wallet as service bindings, and Cloudflare
# refuses to publish a Worker whose binding names a Worker that does not exist
# yet. In the parallel matrix above the gateway could reach its publish step
# before wallet finished, which is exactly the failure this job exists to stop:
# a matrix cannot express "deploy last". So gateway deploys on its own, after
# every binding it names is guaranteed to exist.
#
# `register-schemas` is listed explicitly rather than relied on transitively
# through `deploy-workers`. The gateway is the Worker that reads
# `SCHEMA_REGISTRY` on a mounted public route, so "the registry is populated
# before this is published" is a claim about *this* job and belongs in its
# dependency list where it can be read.
deploy-gateway:
needs: [quality, deploy-workers, register-schemas, migration-drift]
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
# `DATABASE_URL` for `/p/{slug}`, the public per-merchant page a Google
# class review opens. The gateway reads it directly rather than reaching a
# worker over a service binding, because every `/v1/*` route requires a JWT
# and that page must answer with no credentials at all. Same secret, same
# `--var` mechanism `identity` and `wallet` use two steps above.
#
# The three flags below back `POST /v1/support` (`src/support.ts`), the
# public support channel on the card screen. All three are absent until the
# corresponding secret exists in this repository, and that is the intended
# state: the route fails **closed** without them, answering 503 and sending
# nothing, rather than skipping its Turnstile verification or guessing a
# sender domain. A deployment whose `RESEND_API_KEY` is empty has an honest,
# visible, non-functional support channel — which is the correct description
# of a channel nobody has provisioned yet.
#
# `SUPPORT_EMAIL_FROM` is not a secret. It is a flag anyway, because it names
# a Resend domain that has to be *verified* in the Resend console and none is
# verified for this project. Declaring a plausible-looking domain in
# `wrangler.jsonc` would satisfy `wrangler-config.contract.test.ts` and every
# behavioural test while making Resend reject every send with a 422.
#
# NOTE these flags do NOT replace `vars` in wrangler.jsonc — they merge into
# it. The line below used to claim the opposite and was wrong;
# `wrangler-config.contract.test.ts` documents the merge as empirically
# verified (`wrangler deploy --var DATABASE_URL:… --dry-run` published the
# seven declared vars of `workers/wallet` alongside the flag, on 4.107.0 and
# again on 4.147.0), and `SUPPORT_EMAIL_TO` — declared in `vars` and not
# passed here — would not survive a replace.
- name: Deploy gateway worker
run: |
npx --yes wrangler deploy \
--var JWT_SECRET:"$JWT_SECRET" \
--var DATABASE_URL:"$DATABASE_URL" \
--var RESEND_API_KEY:"$RESEND_API_KEY" \
--var SUPPORT_EMAIL_FROM:"$SUPPORT_EMAIL_FROM" \
--var TURNSTILE_SECRET_KEY:"$TURNSTILE_SECRET_KEY"
working-directory: apps/gateway
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
# The secrets arrive through the environment, and the shell expands
# them inside quotes. A secret interpolated straight into the command
# line is a secret the shell will interpret — and a connection string
# contains `&`, which a shell reads as "run the next thing in the
# background".
JWT_SECRET: ${{ secrets.JWT_SECRET }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
SUPPORT_EMAIL_FROM: ${{ secrets.SUPPORT_EMAIL_FROM }}
TURNSTILE_SECRET_KEY: ${{ secrets.TURNSTILE_SECRET_KEY }}
deploy-dashboard:
needs: [quality, migration-drift]
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
# The Pages project stays in place and untouched: its hostname is still
# what the dashboard is reached at until the cut-over, and deleting it here
# would break a URL before a replacement exists.
- name: Build with the OpenNext Cloudflare adapter
run: pnpm cf:build
working-directory: apps/dashboard
env:
NEXT_PUBLIC_API_URL: ${{ secrets.NEXT_PUBLIC_API_URL || 'https://gateway.cl-jmunoz.workers.dev' }}
- name: Deploy the dashboard Worker
run: pnpm cf:deploy
working-directory: apps/dashboard
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
deploy-customer-web:
needs: [quality, migration-drift]
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
# `NEXT_PUBLIC_TURNSTILE_SITE_KEY` is the build-time half of the support
# channel's bot protection (`POST /v1/support` in `apps/gateway`). Empty until
# a Turnstile widget is created for this project, and the form renders its
# "not available" state without it rather than rendering a widget that cannot
# work — so leaving this unset is a visible, non-functional channel rather than
# an unprotected one. It is a public key by design: Cloudflare's site keys are
# meant to be readable in the page source, and only the matching secret (passed
# to the gateway above as `TURNSTILE_SECRET_KEY`) authorises a send.
#
# `TURNSTILE_SECRET_KEY` is deliberately NOT defaulted to one of Cloudflare's
# published testing keys. Those exist so an integration can be written before a
# widget exists, which makes one of them the single most likely way this route
# ends up accepting every bot in production with every test green.
# The Pages project stays in place and untouched: its hostname is printed
# in merchant QR codes and embedded in already-issued passes, so it is
# still how this app is reached until the cut-over.
- name: Build with the OpenNext Cloudflare adapter
run: pnpm cf:build
working-directory: apps/customer-web
env:
NEXT_PUBLIC_API_URL: ${{ secrets.NEXT_PUBLIC_API_URL || 'https://gateway.cl-jmunoz.workers.dev' }}
NEXT_PUBLIC_TURNSTILE_SITE_KEY: ${{ secrets.NEXT_PUBLIC_TURNSTILE_SITE_KEY }}
# The VAPID public key is public by design: the browser subscribes
# with it. The private half never reaches the client.
NEXT_PUBLIC_VAPID_PUBLIC_KEY: ${{ secrets.NEXT_PUBLIC_VAPID_PUBLIC_KEY }}
- name: Deploy the customer-web Worker
run: pnpm cf:deploy
working-directory: apps/customer-web
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}