The vercel CLI deploy command has the option to pass build environment variables, because the build is happening at Vercel. We are trying to do the build on our CI/CD server and using the build command to accomplish this and then use the prebuilt flag for the deploy.
The vercel CLI build command doesn’t have an option to pass environment variables to use during the build. In theory, this should only affect NEXT_PUBLIC_ variables, since the others are accessed at runtime. Is there a recommended way to pass environment variables to the build command?
This would be used to override an environment variable for a Preview deploy.
We have an application we are building that, normally, the preview builds point at an API in a UAT environment. Occasionally, we would like to point a preview build at the APIs DEV environment. The URL for the API is in an environment variable, so we would like to change the value of that variable only for that build.
Note: We are using Azure DevOps, so unable to use Git integration. Basically, we need the equivalent of “specific branches” for the CLI using pre-built deploys (running ‘vercel build’ then ‘vercel deploy --prebuilt’)