Back to Home

The process of making my website (Part 3)

Posted on Friday, 14 February 2020 - Suggest An Edit
#react#website

Introduction

Hi everyone. Welcome to the last part of the 3 part series. This time, I will talk about how I deploy my site to Github Pages. It’s a simple yet a fun process. So, let’s get into the first step shall we.

Deployment

Manually using gh-pages

First of all, I installed gh-page package from npm by executing

$ npm install gh-pages

and creating a custom script to my package.json like so:

"deploy": "gatsby build && gh-pages -d public -b master",

and to deploy my site, I would simply run npm run deploy. It will automatically deploy my site to github pages.

But, I have to move my source code to other branch because the master branch will be used for the compiled code/the actual site. So I made a new branch called source. Everything seems great, until something bothers me.

The life saver: TravisCI

Initially, what I want to do is commit to the repo, push it, and deploy it manually. Could you imagine how frustrating it is to do all of those things? It would be tedious. Then, I came across an article that talk about TravisCI. Here it is if you want to read it yourself, it was a good one.

After configuring TravisCI, I can just simply push to the repo and TravisCI will build the site for me automatically. Isn’t that cool?

Special Thanks

Before I end this blog, I have quite a list of people that I want to say thank you. Big thanks even! So, here we go.

Comments