Repository navigation
91 lines (85 loc) · 2.41 KB
/
Copy pathdeploy.yml
File metadata and controls
91 lines (85 loc) · 2.41 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
name: Deploy Rspress site to Pages
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Not needed if lastUpdated is not enabled
- name: Setup Bun
uses: oven-sh/setup-bun@v1
- name: Install dependencies
run: bun install
- name: Prepare documentation build memory
run: |
free -h
df -h /
sudo fallocate -l 8G /swapfile-scripting-docs
sudo chmod 600 /swapfile-scripting-docs
sudo mkswap /swapfile-scripting-docs
sudo swapon /swapfile-scripting-docs
free -h
- name: Build with Rspress
env:
NODE_OPTIONS: --max-old-space-size=4096
RSPRESS_SSG_CONCURRENCY: 2
run: |
sample_resources() {
date -u +'%FT%TZ'
free -m
df -m .
grep '^oom_kill ' /proc/vmstat
cgroup="/sys/fs/cgroup$(awk -F: '$1 == "0" {print $3}' /proc/self/cgroup)"
for metric in memory.current memory.peak memory.max memory.swap.current memory.events; do
if [ -r "$cgroup/$metric" ]; then
echo "$metric:"
cat "$cgroup/$metric"
fi
done
ps -eo pid,ppid,rss,comm --sort=-rss | head -n 7
}
while true; do
sample_resources
sleep 15
done &
sampler_pid=$!
trap 'kill "$sampler_pid" 2>/dev/null || true' EXIT
build_status=0
bun --bun run deploy || build_status=$?
sample_resources
exit "$build_status"
- name: Report build memory
if: always()
run: |
free -h
df -h /
sudo dmesg | grep -iE 'out of memory|killed process|oom-kill' || true
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: doc_build
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4