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
name: Build and Deploy React App to GitHub Pages | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 14 | |
- name: Install dependencies | |
run: npm install | |
- name: Remove babel and install babel-cli | |
run: | | |
npm uninstall babel | |
npm install --save-dev babel-cli | |
env: | |
CI: true | |
- name: Build HTML files from JSX | |
run: | | |
npm run build | |
npx babel --out-dir build ./src/components --extensions .jsx | |
env: | |
CI: true | |
- name: Deploy to GitHub Pages | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Your Name" | |
git checkout --orphan gh-pages | |
git rm -rf . | |
mv build/* . | |
git add . | |
git commit -m "Deploy to GitHub Pages" | |
git push origin HEAD:gh-pages --force | |
env: | |
CI: true |