intermediate
Build
Produce production assets or packages in CI to catch bundling, environment, and dependency issues before deploy.
The build step proves production compilation, bundling, asset generation, route generation, and environment configuration under clean conditions. It catches errors local dev servers often hide.
- run: npm run build
env:
NODE_ENV: production
# Public build-time vars only — never secrets
VITE_API_URL: https://api.example.com
Framework-specific builds (Next.js, Nuxt, Astro) may run SSR, static generation, or edge compilation. Separate public `VITE_` / `NEXT_PUBLIC_` variables from secrets that belong only at runtime.
On interviews: build-time versus runtime environment variables, SSR or SSG failures, bundle analysis, source maps, and artifact handoff to deploy.
Common pitfalls: building only after merge delays feedback; injecting production secrets at build time can leak them into static client bundles.
The trade-off is early failure signal versus longer PR pipelines.
Checklist:
- Build before merge for application repos.
- Separate public and secret environment values.
- Publish build outputs predictably as artifacts.
- Verify production config paths, not only dev.