- Published on
How to Ignore Preview Deployments in Vercel
- Authors
- Name
- Ashik Nesin
- @AshikNesin
Preview Deployments are such useful things for a large project where we have multiple people working on it. And where you want to test something without thinking about breaking your production code.
But that might not be helpful for side projects where you just want to keep things simple and even fine with breaking production for a couple of minutes :)
Vercel builds and deploys preview URL for all the new commits. It uses SHA of the git commit to decide whether to deploy a new preview or not.
Sometimes, you just want to trigger build only for main
branch. For such cases, you can Ignored Build Step section.
To do this, click on Git setting in Deployments page
In this we can run any command and depending on the exit status build is triggered or ignored. or you can choose your predefined configuration as well.
If it returns 0
then the build is skipped and for 1
the build is trigger
if [ "$VERCEL_ENV" == "production" ]; then exit 1; else exit 0; fi
Here is the PR in which the deployment preview has been ignored:
Reference
Happy simple deployments!