Skip to content

Commit bc2e2ae

Browse files
authored
Merge pull request #1814 from quantified-uncertainty/fix/vercel-deploy-on-production-push
fix: replace hourly scheduled deploy with per-push deploy on production
2 parents 4efa197 + 8709bc5 commit bc2e2ae

File tree

3 files changed

+33
-77
lines changed

3 files changed

+33
-77
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,35 @@ jobs:
331331
332332
gh issue create --title "$TITLE" --body "$BODY" --label "bug,groundskeeper-autofix"
333333
334-
# Deploy job removed — production deploys are now handled by the scheduled
335-
# deploy hook (scheduled-deploy.yml, every hour) instead of per-push.
336-
# This caps Vercel build minutes at 24/day max vs 50-80/day previously.
337-
# vercel.json sets github.enabled=false to prevent Vercel from posting
338-
# PR failure statuses (deploy hooks bypass the GitHub integration).
334+
deploy:
335+
# Trigger Vercel production deployment after CI passes on the production branch.
336+
# Vercel GitHub integration is disabled (vercel.json github.enabled=false) to
337+
# prevent PR failure statuses — deploy hooks bypass the GitHub integration.
338+
# The VERCEL_DEPLOY_HOOK_URL secret must be a hook configured for the "production" branch.
339+
needs: [ci, migrate-test]
340+
if: vars.AUTOMATION_PAUSED != 'true' && github.ref == 'refs/heads/production' && github.event_name == 'push'
341+
runs-on: ubuntu-latest
342+
timeout-minutes: 10
343+
344+
steps:
345+
- name: Trigger Vercel production deployment
346+
run: |
347+
if [ -z "${{ secrets.VERCEL_DEPLOY_HOOK_URL }}" ]; then
348+
echo "::error::VERCEL_DEPLOY_HOOK_URL secret is not set."
349+
echo "Go to Vercel Dashboard → Project → Settings → Git → Deploy Hooks"
350+
echo "Create a hook for Branch 'production', then add the URL as a GitHub secret."
351+
exit 1
352+
fi
353+
354+
RESPONSE=$(curl -s -o /tmp/vercel_response.json -w "%{http_code}" \
355+
-X POST "${{ secrets.VERCEL_DEPLOY_HOOK_URL }}")
356+
357+
echo "HTTP status: $RESPONSE"
358+
cat /tmp/vercel_response.json
359+
360+
if [ "$RESPONSE" -ge 200 ] && [ "$RESPONSE" -lt 300 ]; then
361+
echo "Production deployment triggered."
362+
else
363+
echo "::error::Vercel deploy hook returned HTTP $RESPONSE"
364+
exit 1
365+
fi

.github/workflows/scheduled-deploy.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.

apps/web/vercel.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"framework": "nextjs",
44
"installCommand": "cd .. && npx pnpm@9 install",
55
"buildCommand": "node scripts/build-data.mjs && next build",
6-
"_ignoreCommandNote": "Vercel ignoreCommand uses INVERTED exit codes: exit 1 = BUILD (do not skip), exit 0 = SKIP. This is the opposite of Unix convention. The command below builds only the 'production' branch.",
6+
"_ignoreCommandNote": "Vercel ignoreCommand uses INVERTED exit codes: exit 1 = BUILD (do not skip), exit 0 = SKIP. This is the opposite of Unix convention. The command below builds only the 'production' branch. Deploy hook in ci.yml is configured for Branch 'production' so this always passes.",
77
"ignoreCommand": "bash -c '# Vercel exit code convention: exit 1=BUILD (do not skip), exit 0=SKIP (ignore). Opposite of normal Unix convention.\n[[ $VERCEL_GIT_COMMIT_REF == production ]] && exit 1; exit 0'",
88
"github": {
99
"enabled": false

0 commit comments

Comments
 (0)