Hi, @ruiramos. The only way to do that would be to link the repo to a second site at Netlify and make some other branch the production branch. Then the branch main could be a non-production branch on the second site.
Please let us know if there are other questions about this.
I’d have to manually replicate the environment variables between projects, right? If so, I guess then I wouldn’t necessarily need it to be a branch deploy at that point (could just be the secondary project production with non-prod env vars from the first)
Anyway, is there any way we could suggest this as a feature request? I think it’s probably low hanging fruit and a fairly common use case.
I don’t think this will ever make as a feature because this is already possible. Simply create a branch from your production branch, don’t change any content or code and deploy it to Netlify. I don’t see why this needs a whole new feature, unless I’m missing something.
That would work for the initial deployment, but would require that other branch to be kept in sync with “main” manually, so I don’t think this is currently possible, not the way branch deployments work.
I think you’ve got a very weird pipeline - definitely not what I’ve seen or experienced before. Usually, people create a branch from main, push changes to that branch only and when all looks good, create a PR to merge it to main.
Hi, @ruiramos. Looking at this thread, it appears that all that remains is that you want us to file a feature request based on this:
What is not clear is this:
What feature request do you want us to file?
You also said this:
With that workflow, no one but you knows what the environment variables should be for the new site. What is the part that you want automated? Linking the repo? Naming the site? Setting environment variable?
Please provide as much detail as you can when replying.
What I’m suggesting as a feature request is the ability to create a branch deployment of your production branch. This would work just like any other branch deployment, namely:
it would have a unique “branch” url
it would update (build/deploy) whenever the branch gets updated with new commits
it would use the env vars specified for branch deployments
The use case is having a separate URL - sorry if this was unclear - where the production/main code is deployed using non-prod environment variables. You could think about this as new staging or qa environment, except I don’t really need a new branch for this - just the production code and non-prod credentials. Hope this makes sense.
I’d suggest we are unlikely to build that, since it is possible to accomplish exactly that using today’s featureset. How?
I’d set up a second site,
set the config up differently (e.g., don’t have your main branch set as production, so it acts more like a branch deploy, or you can set different variables/contexts in the UI if you want it to behave differently),
and then you can have the same effect today, without us implementing anything