restore friendlinks #29
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 | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
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: '20' # 修改为 Node.js 20 | |
- name: Install dependencies | |
run: npm ci # 使用 ci 命令清理并安装依赖,确保是最新的 | |
- name: Build project | |
run: npm run build | |
- name: List build output | |
run: ls -R docs # 检查 docs 目录是否存在并列出内容 | |
- 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 # 确保你要部署的文件夹 | |
clean: true # 清理旧的部署文件 | |
token: ${{ secrets.ACCESS_TOKEN }} # 使用 Access Token 进行身份验证 |