Home
Support Forums

Stop auto-publishing branch deploys

Hi,

We have a fairly complex setup in netlify that is helping us manage the transition from an old app to a new one. We are heavily using the branch deploys feature to enable this.

Basically our git repo is connected to multiple netlify sites, which support different environments on our backend platform. e.g. one for staging, one for production etc

In the repo, we have our main branch, which is configured as the ‘production’ deploy in each netlify site, and deploys the app normally, and a branch called iframe which is configured as a branch deploy in each netlify site. (The iframe branch renders the app in a slightly different way so that it can be consumed inside a legacy app, while we transition to the new one)

In the ‘production’ netlify site, we would like to be able to control deploys, so that we can decide when to push a feature into production. We know we can do this for merges to the main branch by switching off auto publishing in the production site, and manually publishing new versions when we want to. However we would like to replicate this for pushes to the iframe branch too, but it seems that netlify will just automatically build and deploy every commit and there is no ‘manual publish’ option for branch deploys specifically. Is there a way we can work around this?

Hi @samblacklock,

Yes it’s not possible at the moment. This is how it works currently:

Branch Deploy is treated as any other deploy and can be published to the main website. So if you lock publishing to the production, it’ll lock for branch deploys too. Once you publish a branch deploy as your production version, you could lock publishing to it, but you definitely don’t want to replace your production deploy with a branch deploy.

So you have 3 options:

  1. Publish your branch deploy as a different website altogether. Then you can stop auto-publishing for it.
  2. Use the unique URL for the branch deploy so even after new deploys, that URL won’t change.
  3. Use [skip ci] anywhere in your commit message and Netlify won’t build (and thus, won’t publish) that deploy.

Does any of this work for you?

Thanks for the reply @hrishikesh, a couple of those options may work for us, we will give them a try

1 Like