-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (90 loc) · 2.32 KB
/
Copy pathdeploy.yml
File metadata and controls
115 lines (90 loc) · 2.32 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Deploy VitePress to GitHub Pages
on:
push:
branches: [main]
workflow_dispatch:
concurrency:
group: pages
cancel-in-progress: false
permissions:
contents: read
defaults:
run:
shell: bash
jobs:
build:
name: Build VitePress
runs-on: ubuntu-latest
timeout-minutes: 100
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v6
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Check runner resources
run: |
echo "Node version:"
node -v
echo "pnpm version:"
pnpm -v
echo "Memory:"
free -h
echo "Disk:"
df -h
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Expand swap
run: |
# 使用磁盘临时扩展 swap,缓解大量 Markdown 构建时的 OOM
sudo dd if=/dev/zero of=/mnt/swapfile bs=1M count=16384 status=progress
sudo chmod 600 /mnt/swapfile
sudo mkswap /mnt/swapfile
sudo swapon /mnt/swapfile
echo "Swap status:"
swapon --show
echo "Memory status:"
free -h
# 构建
- name: Build VitePress
env:
NODE_OPTIONS: --max-old-space-size=20480
run: pnpm docs:build
- name: Validate build output
run: |
test -d .vitepress/dist
test -f .vitepress/dist/index.html
du -sh .vitepress/dist
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v4
with:
path: .vitepress/dist
retention-days: 1
deploy:
name: Deploy GitHub Pages
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4