Auto deploy react apps with ease using Github actions

Phanendra Guptha Katta
3 min readJan 9, 2022

Hey folks! If you are a react developer who writes code often and pushes to production manually, you are not alone. Today we are going to automate the process using GitHub actions and GitHub pages. Let’s delve into it.

1. Create a new react app

npx create-react-app react-autodeploy
cd react-autodeploy

2. Add GitHub pages

I am using yarn here. Please feel free to use npm if you like it.

yarn add -D gh-pages
npm install gh-pages --save-dev

3. Create a Github repo and configure homepage link

Use the below url to create a new repo or you can create manually.

<http://repo.new/>

add the below code in your package.json file

"homepage": "http://{github-username}.github.io/{github-repo-name}"

4. Push code to Github

rm -rf .git
git init
git add .
git commit -m "first commit"
git branch -M main
git remote add origin

--

--