Sign in

How to deploy a static React app on GitHub Pages and Setup GitHub Actions to automate the build process

Photo by Yancy Min on Unsplash

What is GitHub Pages?

First Steps

New Git repository called gitpage
npx create-react-app gitpage
// wait for create-react-app to finish...
cd gitpage
npm start

Pushing to GitHub and setting up

“homepage”: “https://{username}.github.io/gitpage/",
git remote add origin git@github.com:{username}/gitpage.git
git push -u origin master
git checkout -b gh-pages
git push -u origin gh-pages

Setting up GitHub Actions to build and deploy on new push

git checkout master
git pull

Testing out

<p>
Hello GitHub Pages!
</p>
git add .
git commit -m "Changed to Hello GitHub Pages!"
git push origin master

Serialize Yourself. Full-stack web developer with a focus in ReactJS, Node, Mongo, Redux and GraphQL

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store