|
1 | | -# 构建 Rspress 站点并将其部署到 GitHub Pages 的示例工作流程 |
2 | | -# |
3 | | -name: Deploy Rspress site to Pages |
4 | | - |
| 1 | +name: Deploy |
5 | 2 | on: |
6 | | - # 在针对 `main` 分支的推送上运行。如果你 |
7 | | - # 使用 `master` 分支作为默认分支,请将其更改为 `master` |
8 | | - push: |
9 | | - branches: [master] |
| 3 | + push: |
| 4 | + branches: master |
| 5 | + pull_request: |
| 6 | + branches: master |
10 | 7 |
|
11 | | - # 允许你从 Actions 选项卡手动运行此工作流程 |
12 | | - workflow_dispatch: |
| 8 | +jobs: |
| 9 | + deploy: |
| 10 | + name: Deploy |
| 11 | + runs-on: ubuntu-latest |
13 | 12 |
|
14 | | -# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages |
15 | | -permissions: |
16 | | - contents: read |
17 | | - pages: write |
18 | | - id-token: write |
| 13 | + permissions: |
| 14 | + id-token: write # Needed for auth with Deno Deploy |
| 15 | + contents: read # Needed to clone the repository |
19 | 16 |
|
20 | | -# 只允许同时进行一次部署,跳过正在运行和最新队列之间的运行队列 |
21 | | -# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成 |
22 | | -concurrency: |
23 | | - group: pages |
24 | | - cancel-in-progress: false |
| 17 | + steps: |
| 18 | + - name: Clone repository |
| 19 | + uses: actions/checkout@v4 |
25 | 20 |
|
26 | | -# 设置当前环境时区 |
27 | | -env: |
28 | | - TZ: Asia/Shanghai |
| 21 | + - name: Install Deno |
| 22 | + uses: denoland/setup-deno@v2 |
| 23 | + with: |
| 24 | + deno-version: v2.x |
29 | 25 |
|
30 | | -jobs: |
31 | | - # 构建工作 |
32 | | - build: |
33 | | - runs-on: ubuntu-latest |
34 | | - steps: |
35 | | - - name: Checkout |
36 | | - uses: actions/checkout@v4 |
37 | | - with: |
38 | | - fetch-depth: 0 # 如果未启用 lastUpdated,则不需要 |
39 | | - #- uses: pnpm/action-setup@v3 # 如果使用 pnpm,请取消注释 |
40 | | - - uses: oven-sh/setup-bun@v1 # 如果使用 Bun,请取消注释 |
41 | | - with: |
42 | | - version: latest |
43 | | - - name: Setup Node |
44 | | - uses: actions/setup-node@v4 |
45 | | - with: |
46 | | - node-version: 20 |
47 | | - # cache: yarn # 或 npm / pnpm / yarn |
48 | | - - name: Setup Pages |
49 | | - uses: actions/configure-pages@v5 |
50 | | - - name: Install dependencies |
51 | | - run: bun install # 或 npm ci / pnpm install / yarn install / bun install |
52 | | - - name: Build with Rspress |
53 | | - run: bun run build # 或 pnpm docs:build / yarn docs:build / bun run docs:build |
54 | | - - name: Upload artifact |
55 | | - uses: actions/upload-pages-artifact@v3 |
56 | | - with: |
57 | | - path: doc_build |
| 26 | + - name: Install Node.js |
| 27 | + uses: actions/setup-node@v4 |
| 28 | + with: |
| 29 | + node-version: lts/* |
| 30 | + |
| 31 | + - name: Install step |
| 32 | + run: "bun install" |
| 33 | + |
| 34 | + - name: Build step |
| 35 | + run: "bun run build " |
58 | 36 |
|
59 | | - # 部署工作 |
60 | | - deploy: |
61 | | - environment: |
62 | | - name: github-pages |
63 | | - url: ${{ steps.deployment.outputs.page_url }} |
64 | | - needs: build |
65 | | - runs-on: ubuntu-latest |
66 | | - name: Deploy |
67 | | - steps: |
68 | | - - name: Deploy to GitHub Pages |
69 | | - id: deployment |
70 | | - uses: actions/deploy-pages@v4 |
| 37 | + - name: Upload to Deno Deploy |
| 38 | + uses: denoland/deployctl@v1 |
| 39 | + with: |
| 40 | + project: "zxk" |
| 41 | + entrypoint: "index.html" |
| 42 | + root: "doc_build" |
| 43 | + |
| 44 | + |
0 commit comments