Today I wanted to do the following for all of my Vercel projects under my team:
- Make Production environment deployments deploy on push to my Git repository.
- Make all other Preview environments not deploy on push, and only deploy one of these when a branch is specifically a branch called “develop”.
Requirement 1 was easy to do, since it is pretty much the default for Vercel. However, for number 2 I had some problems and would like to share my frustrations:
-
I found the vercel.json git.deploymentEnabled config, and thought that it could be useful. However, when I tried to use it, it became clear that I cannot achieve what I wanted because of the limited configurations I could do here. I can only disable specific branches. Not disable all branches and allow only some.
- My Feedback: It would be interesting if it was possible to have a more robust configuration here. Like being able to turn off all branches, and allow only some. Maybe allow also the possibility of having matcher patterns for the name of the branch etc. Something like:
Maybe even better, allow this to be PER environment. Something like:"git": { "deploymentEnabled": { "*": false, "develop": true, "myproject-*": true // Disable all deployments except for develop and myproject-* branches }
"git": { "environments": { "production": true, "preview": { "*": false, "develop": true, "myproject-/*": true } } }
- My Feedback: It would be interesting if it was possible to have a more robust configuration here. Like being able to turn off all branches, and allow only some. Maybe allow also the possibility of having matcher patterns for the name of the branch etc. Something like:
-
I also found that the Environments configuration for preview deployments to not be editable. I was only able to edit the configurations for custom environments that I created. Even there, I felt that the settings for it were somewhat limiting. (Could only configure ‘branch is’, ‘branch starts with’, ‘branch ends with’).
- My Feedback: For my needs, I just needed to be able to edit the Preview configuration for this setting. Also, the possibility of having more granular control here would be nice. (Matcher pattern and having multiple rules)
What I ended up doing for my needs is just creating a custom Environment called “Staging” that would only track the develop branch. Then I am disabling the Preview environment entirely.
Thanks a lot