Skip to content

ci(all): 👷 update (#513) #474

ci(all): 👷 update (#513)

ci(all): 👷 update (#513) #474

Workflow file for this run

name: 部署到 Cloudflare Pages
on:
push:
branches:
- 'main' # 当推送到 main 分支时触发
paths:
- 'docs/**'
- '.github/workflows/deploy-docs.yml'
- 'package.json'
- 'packages/**'
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
# 第一步:检出代码
- name: 检出代码
uses: actions/checkout@v4
with:
fetch-depth: 0
# 第二步:安装 pnpm
- name: 安装 pnpm
uses: pnpm/action-setup@v4
# 第三步:安装 node 并配置缓存
- name: 设置 Node.js 环境
uses: actions/setup-node@v4
with:
node-version: 'latest'
registry-url: 'https://registry.npmjs.org/'
cache: 'pnpm'
# 第四步:安装依赖
- name: 安装依赖
run: pnpm install
- name: 更新主题包
run: pnpm update @project-trans/vitepress-theme-project-trans@prerelease
# 第五步:构建项目
- name: 构建项目
run: pnpm build # 构建 VitePress 项目
# 第六步:发布到 Cloudflare Pages
- name: 发布到 Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }} # Cloudflare Pages API Token
accountId: ${{ secrets.CLOUDFLARE_PAGES_ACCOUNT }} # Cloudflare 账户 ID
command: pages deploy docs/.vitepress/dist --project-name=rle-wiki
# Optional: Enable this if you want to have GitHub Deployments triggered
gitHubToken: ${{ secrets.GITHUB_TOKEN }}