Repository navigation
64 lines (60 loc) · 2.61 KB
/
Copy pathdeploy.yml
File metadata and controls
64 lines (60 loc) · 2.61 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
name: Deploy
on:
push:
branches: [main]
# Weekly rebuild so the compiled roadmap picks up component-plan changes
# even when this repo is untouched; workflow_dispatch for an on-demand one.
schedule:
- cron: "17 6 * * 1"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: deploy-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm run check
# Keep production deploys on the Node suite. The Workers/D1 pool
# suite stays in CI via `pnpm test` so workerd/pool flakes cannot block
# an otherwise unrelated deploy.
- run: pnpm run test:node
- run: pnpm run build
# Migration 0001 is already applied remotely. Keep deployment fail-closed
# until a separately least-privileged D1 token exists for future changes.
- name: Verify production D1 migration baseline
shell: bash
run: |
test "$(find worker/migrations -maxdepth 1 -type f -name '*.sql' | wc -l)" -eq 1
echo "3f820cb7c1f8e76196e83f8bc8448dd9e72e840884fc39641c84e6b9d60ff27f worker/migrations/0001_pegma_storage.sql" |
sha256sum --check --strict
# Worker before Pages: the site is a client of the worker's API, so a
# freshly deployed site must never race ahead of the API it calls.
# CLOUDFLARE_WORKER_API_TOKEN is a SEPARATE least-privileged credential
# (Workers Scripts:Edit + pegma.dev zone Workers Routes:Edit) — the
# Pages token deliberately carries no Worker authority, per the
# credential contract in docs/PROJECT_PLAN.md. Non-secret worker config
# lives in wrangler.jsonc `vars` (a deploy replaces plain vars, so
# dashboard-added vars do not survive); operator secrets persist.
- name: Deploy Worker
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_WORKER_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: pnpm run worker:deploy
- name: Deploy to Cloudflare Pages
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: >
pnpm exec wrangler pages deploy dist
--project-name pegma-dev
--branch main