Automatically deploy branches that match name pattern

Say you frequently produce release/ branches or support/ branches where deployment would be useful. Is it possible to automatically add deploy branches matching ‘release/*’?

@tcardlab, there are three options for this currently:

  • All - Deploy all the branches pushed to the repository.
  • None - Deploy only the production branch.
  • add individual branches

There isn’t a wildcard option, though, which would allow matching only certain branches based on substring matches (like release/*).

We do have an open feature request for this. Is this what you are looking for? If so, please let us know and we’ll get this +1 added to the feature request.

I’m sorry, that feature request was also mine. After realizing it was not currently supported, I wanted to go through the official route and properly suggest the feature.

If you don’t mind, I do have three followup questions while I try to circumvent the issue:

If I were to add individual branches:

  1. Is it possible to programmatically add branches to netlify.toml via lambda function, cms git-gateway, or some other way?

If I were to choose All:

  1. Branch accessibility is important to me. Are all branches given a predictable subdomain, such as the branch name, or is that only the case when added individually?
  2. It was noted here, that a [skip ci] tag can be used to skip commits. I assume there is no equivalent for branching?

Hi @tcardlab,

  1. The netlify.toml needs to be there in your repo at the beginning of your build. The only way to do this programmatically via a lambda function would be to create the file and commit it to your git repo using a function. This is possible but you’ll be writing this code yourself. It’s possible to do this using Github’s API.
  2. All branches deploys have a branch subdomain that’s preditable. It includes the branch name. A branch deploy URL will always point to the latest deploy for that branch.
1 Like

@futuregerald,

Awesome, I should be able to find a sufficient workaround between the two!
Just knowing there’s a reasonable path forward is exciting.

Thanks for the help!

1 Like