Skip to content

CDN自动更新测试 #12

CDN自动更新测试

CDN自动更新测试 #12

Workflow file for this run

name: Build VitePress
on:
push:
branches:
- main # 当 push 到 main 分支时触发
jobs:
build:
runs-on: ubuntu-latest
steps:
# 1. 拉取代码
- name: Checkout Code
uses: actions/checkout@v3
# 2. 设置 Node.js 环境(使用最新版)
- name: Setup Node.js Latest
uses: actions/setup-node@v3
with:
node-version: 'lts/*' # 使用最新 LTS 版本(Long Term Support)
cache: 'npm' # 缓存 npm 依赖,加速构建
# 3. 安装依赖
- name: Install Dependencies
run: yarn install
# 4. 构建 VitePress 项目
- name: Build VitePress
run: yarn docs:build
# 5. 构建结果 推送到 dist 分支
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
publish_branch: dist
publish_dir: ./docs/.vitepress/dist