Axxoul
Axxoul

Reputation: 115

Git push after svn commit for automatic deployement to Heroku?

I am trying to implement a very simple automatic deployment system for my team.

Our code lives in an SVN repo, yet I use heroku to deploy my application (which uses GIT)

Currently I do the following locally:

    svn update
    git add .
    git commit -m "foo"
    git push heroku master

However I would like to automate this process, so that when ANYONE on the team commits new code, it is automatically pushed to heroku and can be viewed on our dev site.

Any easy way of doing this? Maybe setting up an EC2 instance, ssh'ing into it post commit (using a hook script) and running the above commands? But this solution seems overcomplicated..

Upvotes: 2

Views: 1058

Answers (2)

ndeverge
ndeverge

Reputation: 21564

Maybe you should take a look at the SVN post-commit hook: on your SVN server repository, you can add a shell script called post-commit in the PATH_TO_REPO/hooks/ than can be run after each commit of your team.

This script should contains the git commands to push to heroku.

Upvotes: 1

biesior
biesior

Reputation: 55798

Yes it seems overcomplicated, I'd just suggest rather final movement towards the git instead.

In such case you'll have only one VCS to care about (at least for this project) and you will be able to create other useful scenarios.

IE. pushing every change to Heroku (and using it as a transport layer) isn't good idea, sometimes you need to push something to the team mates to split the in-progress work and it's quite obvious, that if you'll send it in such state to Heroku, you'll crash your application. Therefore it would be just easier to have one (other) shared repo (origin) and push everything there, and only if some important part is finished and confirmed by all team members you can just with two lines of code (or with shell script) get the newest state and push to Heroku.

Nowadays creating shared git repositories is just easy task. If you have any host account with SSH access, you can create it using gitolite it's easy to install and to manage repositories and users. And it's quite free.

Other possibility is using some git providers like GitHub or Assambla most probably you can find some free/cheap plans for hosting small projects.

Upvotes: 1

Related Questions