These instructions help to refresh my memory whenever I have to update my website. Check it out here: https://www.stuffibuild.com/
Reference: https://create-react-app.dev/docs/deployment/#github-pages-https-pagesgithubcom
- Assuming that the site was already created and I just need to update it with new content:
npm run deploy # Automatically runs predeploy before deploy
These steps were already done at the beginning:
-
Add
homepage
topackage.json
."homepage": "https://www.stuffibuild.com",
-
Install
gh-pages
.yarn add gh-pages
-
Add
deploy
toscripts
inpackage.json
."scripts": { "predeploy": "npm run build", "deploy": "gh-pages -d build",
-
Ensure that the GitHub pages option in project is set to use the
gh-pages
branch. -
Configure a custom domain with GitHub pages by adding a
CNAME
file to thepublic
folder.
- Clone this repo.
- Install
npm
andNode.js
using nvm - Install dependencies, which creates a
node_modules/
folder.yarn install
- Add a
.env
in the same directory aspackage.json
and populate the following fields:REACT_APP_GOOGLE_ANALYTICS_ID= REACT_APP_EMAILJS_SERVICE_ID= REACT_APP_EMAILJS_TEMPLATE_ID= REACT_APP_EMAILJS_USER_ID=
- Build the project, which creates a
build/
folder.npm run build
- Compile and run the webpage on localhost to check any modifications.
npm start
- If happy with changes, deploy the new version to GitHub pages.
npm run deploy