0

I have been using assembla's SSH deployment tool to setup the automated deployment. What i have done so far is:

  1. Setup a git repo with two branch master and develop.
  2. Setup a SSH script using the following code to deploy on server. nohup sh -c 'cd /path/to/site && git pull' 2>&1 | tee /tmp/log.out
  3. I have setup this script to run manually and its working fine. As my commits are properly deploying upon the script run on the server.

But, I have two different directories on server for staging and production site and I want this script to detect the branch and deploy changes accordingly to the staging/production server directory. So basically,

  1. If I have pushed the changes into the master branch then script should run and deploy the code into the server production directory or take a git pull there through the script commands.
  2. If I have pushed the changes into the develop branch then script should run and deploy the code into the server staging directory or take a git pull there through the script commands.

The problem is assembla doesn't provide an option to invoke the script based on the specific repo branch and if I use the existing setup then on committing code to any branch of repo will invoke the script.

Could someone help me setup this correctly!

Anurag
  • 555
  • 3
  • 10
  • How does your scripts knows that there was push? Do you schedule it with cron? – YuriR Oct 25 '17 at 21:05
  • I am using assembla and so there is a post commit hook available to alert if there is a push in any assembla repo. – Anurag Oct 30 '17 at 08:08

0 Answers0