bashdeploymentgit-flow

Deploying test and production branches of a git repository on two separate subdomains using a script


I am currently working on a Linux bash script to deploy a specified branch of my git project on my website : the develop branch to a test subdomain and the main branch to the main domain.

To do so, I ask for a user input (the branch name) and execute my set of commands to deploy on the right subdomain. The only problem I have is that, these operations involve moving certain parts of the project and so, I don't really see how I could deploy the two versions. To me, the two options are :

  1. Have two repositories to be able to use the two branches separately. This would work fine. BUT, that means I will use double the amount of space which doesn't seem right. (and my project is quite big)
  2. Find a way to deploy two branches of one same repository on two different subdomains independently. Meaning that updating one doesn't update the other.

How could I use one repository from which I deploy two branches on two different subdomains ? Is it even possible ?

I thought that I could just switch to the choosed branch and then update but that changes the project for both versions, which seems logical now since the whole project is accessed.


Solution

  • Turns out what I wanted to achieve is impossible. So, have two branches of a same repo running on two separate domains, I downloaded the project twice and have a script to deploy the branch I want...