Skip to content

Heroku: automatic deployment to Heroku

Gabriel Lebec edited this page Sep 19, 2016 · 3 revisions

Yes, you read that title correctly — you can set up automatic deployment to Heroku from within Heroku itself! Heroku makes this extremely easy, but note that to accomplish the following steps you will either need to be the repo owner (for GitHub user accounts) or an admin (for GitHub organization accounts).

Automatic deployment means that changes to a specific branch (e.g. master) will immediately be incorporated into the live application. This is definitely in the spirit of continuous integration and is just one more way modern tools streamline the development process, letting you focus on the fun stuff — writing your app.

Connecting Heroku to GitHub

  1. Sign in to Heroku
  2. Click the Deploy tab in the nav bar
  3. Next to Deployment Method, select GitHub
  4. Click the Connect to GitHub button
  5. Authorize Heroku's access to your GitHub account
  6. Enter your repo name and click Search
  7. Click connect

Enabling Automatic Deployment

  1. Select which branch will represent your main release branch. You'll probably want to stick with master.
  2. OPTIONAL BUT RECOMMENDED: decide whether you want to wait for CI tests to pass before deploying. Assuming you have CI testing set up, we recommend you enable this option; the only reason you'd disable it is if you don't have CI testing configured, or if you're ok automatically deploying code with failing tests. Can you really justify the latter?
  3. Finally, click Enable Automatic Deploys. That's it!

From now on, every change to master (or your selected branch) will deploy your updated app to Heroku. Pretty nifty! Note that you should not push to the heroku remote any more; your Github account replaces it.