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
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:
- 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:
- 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?
- It was noted here, that a [skip ci] tag can be used to skip commits. I assume there is no equivalent for branching?
- 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.
- 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.
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!
I would find this feature useful as well.
We frequently create feature branches and merge them to master but don’t always want to release these features immediately. We control the release cadence by branching from master with
release/* branches and these are what get published (e.g. release/v1.2)
We would like to have a similar setup with Netlify where only
release/* branches get published to production. But have the integration with GitHub feature where you can preview what the site looks like with any feature branch, etc.
Sounds like the workaround for now is to manually add the release/* branches to Netlify. But what I’m not sure about is if you can do this without a subdomain:
Thanks, added your name to the feature request around wildcard matches in branch name specification!
re: publishing more than one branch to production, no, we wouldn’t intend to enable that workflow directly. You could certainly do something like send your notifications for successful builds to a service like zapier, and based on the branch name (zapier CAN parse the branch name to look for patterns like the one you want), selectively use our API to publish, in case your conditions are met:
You could also use the API to update the site’s production branch name (see this article for details on how to discover the API calls needed for any operation our UI can do:
), and then we’d auto-publish based on the new branch being the production one before we receive a commit notification
That feature would be useful for me as well.
My use case is somehow different. Due to the lack of an ability to remove preview branch (e.g. some work-in-progress version to show someone) I have another “disposable” site for that repo (to be able to delete the whole site if needed) and I would like to publish there only pages from branches
disposable/*. Now I have to specify manually
disposable/preview2 and/or reuse branches.
Thanks, I’ve added your vote to the feature req