deploy-health-check

Run a framework-specific deployment with pre-deploy build/test validation and post-deploy HTTP health check.

Deploy + Health Check

Deploy the current project and verify it is healthy afterward.

Instructions

  1. Detect framework and deploy target:

    • Check package.json dependencies for: next, remix, nuxt, @sveltejs/kit, astro
    • Check for config files: vercel.json → Vercel, fly.toml → Fly.io, wrangler.toml → Cloudflare, railway.json → Railway, render.yaml → Render
    • If both a framework and a deploy target are found, announce them: "Detected: Next.js → Vercel"
    • If ambiguous, ask: "What is your deploy target? (Vercel / Fly.io / Cloudflare / Railway / Render / Other)"
  2. Pre-deploy checks (stop and report if any fail, do not deploy):

    • Run tests: npm test / yarn test / pnpm test (skip if no test script in package.json)
    • Run build: npm run build / yarn build / pnpm build
  3. Deploy:

    • Vercel: vercel --prod
    • Fly.io: fly deploy
    • Cloudflare Pages/Workers: wrangler deploy
    • Railway: railway up
    • Render: inform the user — "Render deploys automatically on git push. Push your branch and monitor at render.com/dashboard."
    • Capture the deployment URL from stdout.
  4. Post-deploy health check (wait 15 seconds first):

    curl -s -o /dev/null -w "%{http_code}" <deployment-url>
    
    • HTTP 200–299: healthy ✓
    • HTTP 4xx/5xx or no response: report the status and suggest checking logs with the platform's CLI (e.g., vercel logs, fly logs, wrangler tail)
  5. Smoke test — if a smoke test script exists at scripts/smoke-test.sh or tests/smoke.sh, run it with the deployment URL as an environment variable: DEPLOYMENT_URL=<url> bash scripts/smoke-test.sh. A smoke test passes if the script exits with code 0. Report pass/fail with the script's output.

  6. Final report:

## Deploy Report

- Framework: Next.js
- Target: Vercel
- Pre-deploy tests: ✓ passed
- Build: ✓ passed
- Deploy URL: https://my-app-abc123.vercel.app
- Health check: ✓ HTTP 200
- Smoke tests: ✓ 3/3 passed

Deployment complete.

If any step fails, stop and show the error output. Do not proceed to the next step.