While we deploy our changes to heroku, we use deployment scripts or setup yml in CI server. However Heroku has come up with an auto-deployment feature and for that we do not need to use even command line tools.

  • To take advantage of this feature you should use Github/Bitbucket version control system

  • If your Github/Bitbucket repo is setup and you have already pushed your code to Github then you are good to start with heroku

  • I assume that you already have Heroku account and heroku-toolbelt is setup on your system.

  • Now create an app on heroku for your application. If you do not know how to do that, then you can refer link-1 or link-2

  • Once your app is on heroku navigate to the application page, you will see the Deploy menu and in that tab you will have Github and Bitbucket links. (see the below shown screen )

enter image description here

  • Click on Connect to Github button

  • After authentication it will show you list of organisations and repos. Choose the organisation and repo which you want to connect for auto-deployment (see the below shown screen )

enter image description here

  • Click the connect button

enter image description here

  • After connecting to Github you will see the next section on the Deploy page Automatic Deploys button

  • In this section choose the branch which you want to set for auto deployment. You can choose any branch from the existing listed branches. It is most of the time recommended to use your staging branch for auto-deployment and only use production when you are rest assure that CI test and rails auto deployment work perfectly in Staging. (see the below shown screen )

enter image description here

  • If you are using CI (continuous Integration) and want to do deploy only when all tests pass then CHECK the wait for CI to pass before deploy checkbox

  • Then click the Enable Automation Deploys button

enter image description here

  • Once this is done your repo is setup for auto deployments. Now whenever next commit or merge happens on the selected branch Heroku will auto-deploy these changes. To check this you can check the activity tab of Heroku

Hurray!! You are all set with auto-deployment now