node version #2
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: | |
- master # Change this to your main branch name | |
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: 16 # Change to your Node.js version if needed | |
- name: Install dependencies | |
run: npm install # Replace with your package manager command | |
- name: Build project | |
run: npm run build # Replace with your build command | |
- name: Deploy to GitHub Pages | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "actions@users.noreply.github.com" | |
git checkout --orphan gh-pages | |
git rm --cached -r . | |
mv build/* . | |
git add -A | |
git commit -m "Auto-deployed by GitHub Actions" | |
git branch -D main | |
git branch -m main | |
git push -f origin main:gh-pages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |