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 to gh-pages | |
on: | |
push: | |
branches: | |
- main # Change this to your main branch name | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 14 | |
- name: Install Dependencies | |
run: npm install | |
- name: Build with Webpack | |
run: npm run build # Adjust this command based on your project | |
# deploy: | |
# runs-on: ubuntu-latest | |
# needs: build | |
# steps: | |
# - name: Checkout Repository | |
# uses: actions/checkout@v2 | |
# - name: Set up Node.js | |
# uses: actions/setup-node@v3 | |
# with: | |
# node-version: 14 | |
- name: Deploy to gh-pages | |
run: | | |
git config --global user.email "github-actions@github.com" | |
git config --global user.name "GitHub Actions" | |
echo "printing git status" | |
git status | |
echo "printing ls" | |
ls -l | |
git checkout --orphan gh-pages | |
git rm -rf src | |
# git rm -rf node_modules | |
git rm -rf .gitignore | |
# git add . | |
git add -f dist | |
git add -f index.html | |
git add -f img | |
git commit -m "Deploy to gh-pages" | |
git push -f origin gh-pages |