init auto deploy #15
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: CI Workflow | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # 确保拉取完整的提交历史 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Install dependencies | |
run: | | |
npm ci # 使用 ci 命令清理并安装依赖,确保是最新的 | |
- name: Build project | |
run: npm run build | |
- name: Verify docs directory exists | |
run: | | |
if [ ! -d "docs" ]; then | |
echo "docs directory not found." | |
exit 1 | |
fi | |
- name: Deploy to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages # 部署到 gh-pages 分支 | |
folder: docs # 确保你要部署的文件夹是正确的 |