kanglerian #50
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: Github Personal Website | |
run-name: ${{ github.actor }} | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18' | |
- name: Install dependencies | |
run: npm install | |
- name: Build project | |
run: npm run build | |
- name: After build project | |
run: | | |
rm -rf README.md node_modules index.html package.json package-lock.json public src tailwind.config.js vite.config.js yarn.lock .github | |
mv -f dist/* . | |
rm -rf dist | |
ls -l | |
- name: Deploy to GitHub Pages | |
env: | |
GITHUB_TOKEN: ${{ secrets.DEPLOY }} | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git stash --include-untracked | |
git fetch origin | |
if git ls-remote --exit-code --heads origin gh-pages; then | |
git checkout gh-pages | |
git pull origin gh-pages --rebase | |
else | |
git checkout --orphan gh-pages | |
fi | |
git add . | |
git commit -m "Deploy to GitHub Pages" | |
git push -u origin gh-pages | |
git checkout - | |
git stash pop |