With that we will get started on the deployment. You may collapse this section if you want to view the previous section more clearly.

1. Clone the application from GitHub, create a new branch and add your changes

To start off things, I cloned my git repository and setup my application locally. If you want to know how to do that, check the previous section of the blog (Running it locally – Click on the expand section to view it). Next I created a new branch and switched to it. Command is down below.

git checkout -b stage

I noticed that the previously when I made the application, the UI was less serious than it should be. (Previous UI screenshot available on previous section). So I changed some colours to elevate the look and feel of this (Edited App.scss). Now it looks like this.

Looks pretty professional huh? 😝

2. Push changes on new branch to GitHub

Next, publish changes on new branch to GitHub. (You might want to delete the newly created node_modules directory before doing this).

git status #Verify the files to be added and to which branch 
git add -A #Add all changes if no issues
git status #Verify all required files were added
git commit -m "Created branch - stage. Added required changes" #Commit the changes
git push -u origin stage #Create and push to the new branch "stage" of the Original remote repo 
git status #Verify if your branch is up to date with origin/stage

3. Setup the deployment in Heroku

After that, log in to Heroku or Create an account if you already don’t have one. Steps for creating an entirely new application and creating a new application in a new environment is almost exactly the same. So here, we will look at creating a new application in a new environment.

First, go to your application and select add App and then click on create new. Then follow these steps in the image.

Next, click on the name of the newly created application.

Switch over to the settings tab and click on the show config vars button.

Next, scroll down to the build pack section and add the following build pack. This is used to build our application. Save changes.

https://github.com/mars/create-react-app-buildpack.git

Now, click on the deploy tab and select the connect to Github option. Click on the connect to GitHub button at the bottom of the page. You will be asked to sign in to GitHub and authorize. Click on authorize at this point. After that, you can search for your repo and click on connect.

Lastly, scroll down to manual deploy, select the branch and press deploy. You can enable automatic deploy if you want. But at this point I am only deploying manually.

Now you can sit back and watch the progress. Or go grab a coffee or go for a walk 😄

Finally it will show that you have completed successfully.

https://covid19-dash-sl-stg.herokuapp.com/