Repository navigation
62 lines (57 loc) · 1.6 KB
/
Copy pathdocs.yml
File metadata and controls
62 lines (57 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Docs
# 把 website/ 下的 VitePress 文档站发布到 GitHub Pages:https://derrors.github.io/iphone-control/
# 仓库 Settings → Pages 的 Source 要选「GitHub Actions」
on:
push:
branches: [main]
paths:
- "website/**"
- ".github/workflows/docs.yml"
pull_request:
paths:
- "website/**"
- ".github/workflows/docs.yml"
workflow_dispatch:
permissions:
contents: read
# 正在部署的让它跑完,新的排在后面
concurrency:
group: pages-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0 # 页面的「最后更新」时间取自 git 历史
- uses: pnpm/action-setup@v6
with:
package_json_file: website/package.json
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: pnpm
cache-dependency-path: website/pnpm-lock.yaml
- run: pnpm install --frozen-lockfile
working-directory: website
# 有死链时构建失败
- run: pnpm run docs:build
working-directory: website
- uses: actions/upload-pages-artifact@v5
if: github.event_name != 'pull_request'
with:
path: website/.vitepress/dist
deploy:
if: github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v5