Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Commit 274c8b4

Browse files
committed
ci(deploy): 优化 GitHub Actions 部署流程
- 重构部署工作流,增加构建步骤,减少重复代码 - 添加构建产物上传和下载,提高部署效率 - 更新 Cloudflare Pages 部署配置,使用构建产物 - 新增 Deno Pages 部署步骤,支持多平台部署 - 优化 GitHub App token 生成,提高安全性
1 parent 46c0081 commit 274c8b4

File tree

1 file changed

+38
-4
lines changed

1 file changed

+38
-4
lines changed

.github/workflows/deploy.yaml

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ permissions:
1515
contents: read
1616

1717
jobs:
18-
deploy:
18+
build:
1919
if: "!startsWith(github.head_ref, 'release-please')"
2020
runs-on: ubuntu-22.04
2121
concurrency:
2222
group: ${{ github.workflow }}-${{ github.ref }}
23+
outputs:
24+
app_token: ${{ steps.app_token.outputs.token }}
2325
steps:
2426
- name: 检出仓库
2527
uses: actions/checkout@v4
@@ -30,6 +32,7 @@ jobs:
3032
uses: actions/create-github-app-token@v2
3133
id: app-token
3234
with:
35+
skip-token-revoke: true
3336
app-id: ${{ secrets.APP_ID }}
3437
private-key: ${{ secrets.APP_PRIVATE_KEY }}
3538

@@ -50,16 +53,47 @@ jobs:
5053
run: |
5154
pnpm build:docs
5255
56+
- name: 上传构建产物
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: gi-neko-kit
60+
path: docs/.vuepress/dist
61+
62+
deploy-to-cloudflare-pages:
63+
runs-on: ubuntu-22.04
64+
needs: [build]
65+
steps:
66+
- name: 导入构建产物
67+
uses: actions/download-artifact@v4
68+
with:
69+
name: git-neko-kit
70+
path: ./
71+
5372
- name: 部署到 Cloudflare Pages
5473
id: deploy-cloudflare-pages
5574
uses: AdrianGonz97/refined-cf-pages-action@v1
5675
with:
5776
apiToken: ${{ secrets.CF_TOKEN }}
5877
accountId: ${{ secrets.CF_ID }}
59-
githubToken: ${{ steps.app-token.outputs.token }}
78+
githubToken: ${{ needs.build.outputs.app_token }}
6079
projectName: 'git-neko-kit'
61-
directory: 'docs/.vuepress/dist'
80+
directory: '.'
6281
deploymentName: cloudflare-pages
6382
wranglerVersion: '3.114.9'
64-
6583

84+
deploy-to-deno-pages:
85+
runs-on: ubuntu-22.04
86+
needs: [build]
87+
steps:
88+
- name: 导入构建产物
89+
uses: actions/download-artifact@v4
90+
with:
91+
name: git-neko-kit
92+
path: ./
93+
94+
- name: 设置Deno环境
95+
uses: denoland/deployctl@v1
96+
with:
97+
project: gie-neko-kit
98+
entrypoint: jsr:@std/http/file-server
99+

0 commit comments

Comments
 (0)