docs: 📃 新增 👻 标识 #33
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: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v2 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build project | |
run: pnpm run docs:build | |
- name: Clean up old deployments | |
run: | | |
git fetch origin gh-pages | |
git checkout gh-pages | |
if [ $(git rev-list --count gh-pages) -gt 3 ]; then | |
git reset --hard HEAD~3 | |
git push origin gh-pages --force | |
fi | |
shell: bash | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: docs/.vitepress/dist | |
publish_branch: gh-pages | |
commit_message: 'auto deploy' |