From a2971d0d307cac5c08812c84b4ff7d96b2fc88f7 Mon Sep 17 00:00:00 2001 From: Lee Date: Sat, 21 Sep 2024 18:52:53 +0800 Subject: [PATCH] =?UTF-8?q?feat(ci):=20=E6=B7=BB=E5=8A=A0=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E4=B8=BB=E9=A2=98=E5=8C=85=E5=B9=B6=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E5=88=B0=20Cloudflare=20Pages=E7=9A=84=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy-docs.yml | 17 ++++++---- .github/workflows/update-and-build.yml | 44 -------------------------- 2 files changed, 10 insertions(+), 51 deletions(-) delete mode 100644 .github/workflows/update-and-build.yml diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 598fcc49..5d5bb255 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -3,38 +3,41 @@ name: 部署到 Cloudflare Pages on: push: branches: - - 'main' # 当推送到 main 分支时触发 + - 'main' + 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 - # 第二步:安装 pnpm - 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 项目 - # 第五步:安装 Wrangler - name: 安装 Wrangler run: pnpm add -g wrangler@3 # 安装 Wrangler v3 - # 第六步:发布到 Cloudflare Pages - name: 发布到 Cloudflare Pages uses: cloudflare/pages-action@v1 with: diff --git a/.github/workflows/update-and-build.yml b/.github/workflows/update-and-build.yml deleted file mode 100644 index 6841a0ce..00000000 --- a/.github/workflows/update-and-build.yml +++ /dev/null @@ -1,44 +0,0 @@ -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 # 构建输出目录