Created
May 23, 2021 05:28
-
-
Save sam-ngu/066650d5474a3eba64482114b9cf42c8 to your computer and use it in GitHub Desktop.
Bash script to deploy a React app to Github pages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# abort on errors | |
set -e | |
# build | |
npm run build | |
# navigate into the build output directory | |
cd build | |
# if you are deploying to a custom domain | |
#echo 'myapp.com' > CNAME | |
# creating a git repo in the build folder | |
git init | |
git add -A | |
git commit -m 'deploy' | |
# if you are deploying to https://<USERNAME>.github.io | |
# git push -f [email protected]:<USERNAME>/<USERNAME>.github.io.git master | |
# if you are deploying to https://<USERNAME>.github.io/<REPO> | |
git push -f [email protected]:<USERNAME>/<REPO>.git master:gh-pages | |
cd - | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment