Heroku setup for automatic deployment from GitHub
Tags: javascript, heroku, tutorial, github
Published: 2020-10-29 11:11:06

In the previous [post](https://dev.to/chriss/react-application-setup-for-deploying-on-heroku-75n), I covered steps you need to set in your [React](https://reactjs.org/) application to deploy it on [Heroku](https://www.heroku.com/). What I didn’t cover are the steps that you need to do in Heroku for automatic deployment. That is the focus of this post. I do assume that you already allowed your Heroku account access to your [GitHub](https://github.com/) repository. Also, you can do all these things via Heroku CLI. Still, many beginners feel more comfortable with UI, so I am only focusing on that.
  
### Step 1
When you log into your Heroku account, click on the button with the label “Personal” or open [https://dashboard.heroku.com/apps](https://dashboard.heroku.com/apps). This screen is also a place where you can see a list of all existing apps. If you are using a free Heroku account, be aware you are only allowed five applications.

### Step 2
Click the button with the label “New” (top right button) and select “Create new app” from the dropdown

![Steps 1 and 2](https://dev-to-uploads.s3.amazonaws.com/i/9z846fec5ce8oefh75fo.png)

### Step 3
Give it a meaningful name. I usually prepend with my GitHub username as it is not for production. It affects the generated URL for your application. A region can be anything. I am in Europe, so I use Europe. But it doesn’t make much difference.

### Step 4
Once you create it, it redirects you to the Application page—usually, the Deploy tab. If not already selected, select it.

### Step 5
In the deployment method section, select Github. This action shows extra options for selecting the GitHub repository.

### Step 6
In the connect to the GitHub section, enter the name of your repository. You don’t need to enter the full name, but you need to click the search button. Once you do this, your repository should show below and the connect button next to it. Click that button.

![Steps 5 and 6](https://dev-to-uploads.s3.amazonaws.com/i/iiqbjfjmv3i3eiyz3a47.png)
 
### Step 7
When you connect the repository, a new section is visible called Automatic deploys. In it, you need to select which branch you want to deploy. The main branch is the default option. If you click the button with the label “Enable Automatic Deploys”, each time you push deploy is triggered. You can also start the process manually using the “Manual deploy” section below.
 
![Steps 7](https://dev-to-uploads.s3.amazonaws.com/i/4hjokqbc1i6see8n15dj.PNG)

At this moment, you are all ready, and you can start deploying. You might also want to start the first build manually. In the activity tab, you should see the history of all builds, and if you open logs, once it is all done, you should see a link you can use to access your application. If you missed the required setup on the application level, you can go back to my previous post or check the [example project](https://github.com/kristijan-pajtasev/react-heroku-setup) for it.

---

For more, you can follow me on [Twitter](https://twitter.com/hi_iam_chris_), [LinkedIn](https://www.linkedin.com/in/kpajtasev/), [GitHub](https://github.com/kristijan-pajtasev/), or [Instagram](https://www.instagram.com/hi_iam_chris_/).