Repository navigation
137 lines (125 loc) · 5.59 KB
/
Copy pathstaging-deploy.yml
File metadata and controls
137 lines (125 loc) · 5.59 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
name: Vercel staging deploy
on:
push:
branches:
- dev
paths-ignore:
# Directories the site build never opens, so a change confined to one of
# them cannot alter a rendered page. Verified by grep from src/, scripts/
# and next.config.ts: harnesses/ has no real reference at all (every
# mention is a GitHub URL in prose) and crm/ has one, in a comment.
#
# Deliberately NOT listed, because the build does read them: benchmarks/
# (76 references), alternatives/ (19), answers/ (18), data/ (4), docs/ (4).
# A spec change must still deploy.
- 'harnesses/**'
- 'crm/**'
- 'infrastructure/**'
- 'worker/**'
# The video engine ships to its own renderer (video/deploy).
- 'video/**'
- 'outreach/**'
- 'packages/**'
workflow_dispatch:
concurrency:
group: vercel-staging
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
# 30 min: the build prerenders every bench/product/OG route against
# Prom through a query concurrency cap, and the per-page budget is
# 240s (next.config.ts). 15 min started killing builds once the HL
# bench grew past 60 providers.
timeout-minutes: 30
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
steps:
- uses: actions/checkout@v4
with:
# Full history: scripts/emit-page-mtimes.ts (prebuild) reads each
# content file's last commit for the sitemap <lastmod>. A depth-1
# checkout dates only the files touched by HEAD and every other
# URL falls back to the build time (929 of 929 on 2026-09-19).
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 24
- name: Enable pnpm via corepack
run: |
corepack enable
corepack prepare pnpm@10 --activate
pnpm --version
- name: Install Vercel CLI
run: npm install -g vercel@latest
- name: Pull Vercel env (Preview)
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Build
# Same repository variable as prod-deploy.yml (see the note there).
# Staging events are excluded by the CRM's host filter.
env:
NEXT_PUBLIC_POSTHOG_KEY: ${{ vars.NEXT_PUBLIC_POSTHOG_KEY }}
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Preview
id: deploy
run: |
# --archive=tgz uploads ONE tarball instead of thousands of
# files: the team's api-upload-paid quota (40k reqs / rolling
# 24h) was exhausted twice on busy merge days (2026-07-06/07),
# blocking every deploy for hours.
url=$(vercel deploy --prebuilt --archive=tgz --token=${{ secrets.VERCEL_TOKEN }})
echo "url=$url" >> "$GITHUB_OUTPUT"
echo "Preview ready at $url"
# Alias openchainbench-staging.vercel.app, which this team owns.
#
# Two names were tried before this one and neither works.
# staging-openchainbench.vercel.app is globally unique across Vercel
# and belongs to someone else, so every run from 2026-09-28 died on
# `already in use`. staging.openchainbench.com cannot be used either:
# the apex openchainbench.com is registered under a different Vercel
# team from the one these deployments live in, so this scope gets
# `You don't have access to the domain`, and operating from the
# owning team is refused for an overdue balance. A DNS TXT
# verification record proves control of the DNS but does not move the
# domain between teams.
#
# openchainbench-staging.vercel.app has none of those problems: it is
# already registered to this team and needs no billing, no DNS and no
# cross-team transfer. Kept non-blocking anyway so an alias problem
# never turns a green build red; the preview URL in the summary below
# is always usable regardless.
- name: Update stable staging alias
continue-on-error: true
run: |
vercel alias set "${{ steps.deploy.outputs.url }}" \
openchainbench-staging.vercel.app \
--token=${{ secrets.VERCEL_TOKEN }} \
--scope=${{ secrets.VERCEL_ORG_ID }}
# No warm-up on staging, deliberately.
#
# This step used to fetch the sitemap and request all 184 benchmark
# pages after every deploy, to spare the first visitor a cold render.
# On production that reasoning holds. On staging it does not: a
# staging deploy is read by one reviewer opening a handful of pages,
# and there were 17 staging deploys in the two days to 2026-09-30,
# so the step was paying for about 3,100 cold renders every two days
# nobody was waiting on. Each one queries Prometheus and rebuilds a
# heavy page, which showed up as the two largest lines on the Vercel
# bill, Fluid provisioned memory and active CPU.
#
# The cost of not warming is that the reviewer's first page load is
# slow once, which is the correct trade on a review surface.
# Production warms its hubs only, trimmed the same day for the same
# reason; see prod-deploy.yml.
- name: Comment summary
run: |
{
echo "## Vercel staging deploy ✓"
echo ""
echo "**Stable:** https://openchainbench-staging.vercel.app"
echo ""
echo "**Preview:** ${{ steps.deploy.outputs.url }}"
echo ""
echo "Commit: \`${{ github.sha }}\`"
} >> "$GITHUB_STEP_SUMMARY"