Skip to content

Commit

Permalink
Merge branch 'main' into refactor/split-theme
Browse files Browse the repository at this point in the history
  • Loading branch information
BeiyanYunyi committed Sep 21, 2024
2 parents f12f046 + 1c81a98 commit e9a4979
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ on:
push:
branches:
- 'main' # 当推送到 main 分支时触发
paths:
- 'docs/**'
- '.github/workflows/deploy-docs.yml'
- 'package.json'
- 'packages/**'

jobs:
deploy:
Expand All @@ -26,6 +31,9 @@ jobs:
- name: 安装依赖
run: pnpm install

# - name: 更新主题包
# run: pnpm update @project-trans/vitepress-theme-project-trans@prerelease

# 第四步:构建项目
- name: 构建项目
run: pnpm build # 构建 VitePress 项目
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/preview-pr-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ name: 部署 PR 到 Cloudflare Pages

on:
pull_request_target:
types: [opened, synchronize, reopened] # 当 PR 被创建、更新或重新打开时触发
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'docs/**'
- '.github/workflows/preview-pr-build.yaml'
- 'package.json'
- 'packages/**'

jobs:
deploy:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest

steps:
Expand All @@ -32,6 +38,9 @@ jobs:
- name: 安装依赖
run: pnpm install

# - name: 更新主题包
# run: pnpm update @project-trans/vitepress-theme-project-trans@prerelease

# 第五步:构建项目
- name: 构建项目
run: pnpm build # 构建 VitePress 项目
Expand All @@ -57,7 +66,7 @@ jobs:
script: |
const prNumber = context.payload.pull_request.number;
const previewUrl = `${{ steps.deploy.outputs.url }}`;
const comment = `🚀 预览部署完成! 访问链接: ${previewUrl}`;
const comment = `🚀 预览部署完成 访问链接: ${previewUrl}`;
github.rest.issues.createComment({
issue_number: prNumber,
owner: context.repo.owner,
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/update-and-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: 更新主题包并部署到 Cloudflare Pages

on:
workflow_dispatch:
inputs:
theme_version:
description: '指定的主题包版本'
required: false
default: 'prerelease'

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@${{ github.event.inputs.theme_version }}

- name: 构建项目
run: pnpm build # 构建 VitePress 项目

- name: 安装 Wrangler
run: pnpm add -g wrangler@3 # 安装 Wrangler v3

- name: 发布到 Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }} # Cloudflare Pages API Token
accountId: ${{ secrets.CLOUDFLARE_PAGES_ACCOUNT }} # Cloudflare 账户 ID
projectName: rle-wiki # Cloudflare Pages 项目名称
directory: docs/.vitepress/dist # 构建输出目录

0 comments on commit e9a4979

Please sign in to comment.