🐎 ci: workflow test #5
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 | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
# 使用 pnpm 作为包管理器 | |
- name: Install pnpm | |
run: npm install -g pnpm | |
# 移除 node_modules | |
- name: Remove node_modules | |
run: rm -rf node_modules | |
- name: Install dependencies | |
run: pnpm i | |
- name: Build | |
run: pnpm run build | |
# 部署前清空旧的部署 | |
- name: Cleanup old deployment | |
run: | | |
git worktree prune | |
rm -rf .git/worktrees/github-pages-deploy-action-temp-deployment-folder/ | |
- name: Deploy | |
uses: JamesIves/github-pages-deploy-action@4.1.5 | |
with: | |
branch: gh-pages | |
folder: dist |