Continuous Deployment is awesome because you can forget about the infrastructure part of the development and only focus on the code. Heroku makes it incredibly easy to set it up using Github and Automatic Deploys.


Create a new project

Fork the simple Nodejs project here. Refer to this link for a detailed walkthrough.

Run it locally using,

npm install
node app.js

Go to localhost:3000 and "Goodbye World" should appear on the screen.

Set up a Heroku account

Login to your Heroku account.

Click on New -> Create New App. Give it a name. Click Create App.

Under Deployment  method, click Connect to Github. Search for and connect your repository.

Choose the branch you would like to be deployed. Default to master if unsure.

Enable Automatic Deployments.

Once you are ready to do an initial deployment, click Deploy Branch under Manual Deploy section.

It will try to run the project using the Node.js buildpack. If it is successful, a "Your app was successfully deployed" message will appear. If the deployment failed, try restarting again from Step 1.

Open your app by clicking "View". The output should still be "Hello World".

Deploy Changes

Our pipeline is set up. It's time to take it out for a test drive.

Make a small change to index.html

<!DOCTYPE html>
<html>

<body>
    <h1>Goodbye World</h1>
</body>

</html>

Commit and push the changes by,

git add .
git commit -m "change text"
git push

Once the push is successful, an automatic build is triggered on Heroku. Confirm this by going to the Overview tab of the Heroku dashboard. Under Latest Activity, there will be Build in progress.

Once the status changes to Deployed, click on Open App and your changes should now be live.