pull/497/head
parent
82fbb983ce
commit
1d13cc3f0b
|
@ -11,8 +11,6 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
|
||||||
preview_url: ${{ steps.deploy.outputs.url }}
|
|
||||||
steps:
|
steps:
|
||||||
# 第一步:检出主仓库代码
|
# 第一步:检出主仓库代码
|
||||||
- name: 检出主仓库代码
|
- name: 检出主仓库代码
|
||||||
|
@ -41,25 +39,21 @@ jobs:
|
||||||
# 第五步:构建项目
|
# 第五步:构建项目
|
||||||
- name: 构建项目
|
- name: 构建项目
|
||||||
run: pnpm build # 构建 VitePress 项目
|
run: pnpm build # 构建 VitePress 项目
|
||||||
|
|
||||||
# 第六步:安装 Wrangler
|
- name: Deploy to Cloudflare Pages
|
||||||
- name: 安装 Wrangler
|
|
||||||
run: pnpm add -g wrangler@3 # 安装 Wrangler v3
|
|
||||||
|
|
||||||
# 第七步:发布到 Cloudflare Pages
|
|
||||||
- name: 发布到 Cloudflare Pages
|
|
||||||
id: deploy
|
id: deploy
|
||||||
uses: cloudflare/pages-action@v1
|
uses: cloudflare/wrangler-action@v3
|
||||||
with:
|
with:
|
||||||
apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }} # Cloudflare Pages API Token
|
apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }}
|
||||||
accountId: ${{ secrets.CLOUDFLARE_PAGES_ACCOUNT }} # Cloudflare 账户 ID
|
accountId: ${{ secrets.CLOUDFLARE_PAGES_ACCOUNT }}
|
||||||
projectName: rle-wiki-preview # Cloudflare Pages 项目名称
|
command: pages deploy docs/.vitepress/dist --project-name=rle-wiki-preview
|
||||||
directory: docs/.vitepress/dist # 构建输出目录
|
|
||||||
|
|
||||||
# 第八步:获取预览链接并发送到 PR
|
- name: pr preview action
|
||||||
comment_on_pr:
|
uses: project-trans/pr-preview-action@v1.0.0
|
||||||
needs: deploy
|
with:
|
||||||
uses: project-trans/actions/.github/workflows/comment-pr-preview-link.yml@main
|
previewUrl: ${{ steps.deploy.outputs.deployment-url }}
|
||||||
secrets: inherit
|
BOT_APP_ID: ${{ vars.BOT_APP_ID }}
|
||||||
with:
|
BOT_APP_SECRET: ${{ secrets.BOT_APP_SECRET }}
|
||||||
previewUrl: ${{ needs.deploy.outputs.preview_url }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
REMOVE_PREFIX: docs
|
||||||
|
REMOVE_SUFFIX: .md
|
||||||
|
|
Loading…
Reference in New Issue