Updated CICD for deploy #3
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: Deploy to GitHub Pages | |
on: | |
push: | |
branches: | |
- reactjs-sample | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14.x' # Using Node 14.x | |
- name: Install dependencies | |
run: npm install | |
- name: Build project | |
run: npm run build | |
# Clean gh-pages branch | |
- name: Checkout gh-pages branch and delete all content | |
run: | | |
git fetch | |
git checkout gh-pages | |
git rm -rf * | |
git commit -m "Clean up gh-pages branch" | |
git checkout $GITHUB_REF | |
# Push new content to gh-pages | |
- name: Deploy to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@4.1.5 | |
with: | |
branch: gh-pages | |
folder: build | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} |