Scratch that - it isn’t working
This has been an infuriating process. Most of it is unrelated to the task of “deploy from CI with a token”, but still very much to do with Vercel. After finnicking with this for two days, I have arrived at…
vercel deploy --prebuilt --prod --token=<full account access token>
vercel promote <deployment url> --token=<full account access token>
Why --prebuilt
?
I want to include things like the commit hash and a version name of sorts, whether it be the branch or the release tag. I don’t want to have to specify --env
for each variable I want to ship over to Vercel, plus I would like to be testing the build to be deployed. So I pull the desired variables from vercel, build, test and deploy.
Why vercel promote
?
I’ll start with my UAT environment. Of all the other deployments I do for non-prod, only those issued from the main
branch are visible from my nonprod domain. All other nonprod deployments are only visible from their vercel preview domains. This tells me the git ref influences the deployment environment, and the --prod
flag only influences which environment variables are used.
Since I’m not deploying from a branch - but rather, a tag - this is the equivalent of a preview deployment with production environment variables.
But here’s the catch - the promotion fails due to permission issues, which takes us to…
Why use a token with full account access?
Previous attempts with the org-scoped token failed, and personal-scoped token was creating a new project. The full-account access token finally worked for pull environment variables, building and deploying (including deploying without a prebuilt).
Unfortunately, when I go to promote
I receive…
Error: Deployment belongs to a different team
It seems Vercel is so tightly coupled to branch-based deployments that even your CLI tools can’t escape the side effects.
I feel defeated to find that the alternatives are either more expensive, or are bare-metal solutions. So by default I’ll reluctantly be sticking around with this. Please help.