ci: 调整路径 #2
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: 部署到 Cloudflare Pages | |
on: | |
push: | |
branches: | |
- 'main' | |
paths: | |
- 'docs/**' | |
- '.github/workflows/cf.yml' | |
- 'package.json' | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 检出代码 | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: 安装 pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
version: latest | |
- name: 安装依赖 | |
run: pnpm install | |
- name: 更新主题包 | |
run: pnpm update @project-trans/vitepress-theme-project-trans@prerelease | |
- name: 构建项目 | |
run: pnpm build | |
# 第五步:安装 Wrangler | |
- name: 安装 Wrangler | |
run: pnpm add -g wrangler@3 | |
- name: 将构建输出复制到指定路径 | |
run: | | |
mkdir -p docs/.vitepress/dist/andai-tales # 确保目标路径存在 | |
cp -R docs/.vitepress/dist/* docs/.vitepress/dist/andai-tales/ # 将构建输出复制到 andai-tales 路径 | |
- name: 发布到 Cloudflare Pages | |
uses: cloudflare/pages-action@v1 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_PAGES_ACCOUNT }} | |
projectName: trans-archive | |
directory: docs/.vitepress/dist/andai-tales |