-
Notifications
You must be signed in to change notification settings - Fork 3
203 lines (175 loc) · 7.16 KB
/
deploy-docs.yml
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
name: 部署文档和发布镜像
on:
push:
branches:
# 确保这是你正在使用的分支名称
- main
permissions:
contents: write
jobs:
check-os:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: 检查
run: |-
echo "==== 系统信息 ===="
echo "Hostname: $(hostname)"
echo "CPU Info: $(grep "model name" /proc/cpuinfo | uniq)"
echo "Memory Info: $(free -m | awk 'NR==2{printf "Total: %sMB, Used: %sMB (%.2f%%)\n", $2,$3,$3/$2*100 }')"
echo "Disk Info: $(df -h | awk '$NF=="/"{printf "Total: %dGB, Used: %dGB (%s)\n", $2,$3,$5}')"
echo "==== 网络信息 ===="
echo "IP Addresses:"
ip addr show | grep -w inet | awk '{print $2}'
echo "Default Gateway: $(ip route show default | awk '/default via/ {print $3}')"
echo "DNS Servers: $(grep nameserver /etc/resolv.conf | awk '{print $2}')"
echo "curl ifconfig.icu/all.json"
curl ifconfig.icu/all.json
echo "\n"
echo "==== CPU ===="
lscpu
echo "==== 系统负载 ===="
top -n 1 -b | grep "load average:" | awk '{print $12 $13 $14}'
echo -e "-------------------------------System Information----------------------------"
echo -e "Hostname:\t\t"`hostname`
echo -e "uptime:\t\t\t"`uptime | awk '{print $3,$4}' | sed 's/,//'`
echo -e "Manufacturer:\t\t"`cat /sys/class/dmi/id/chassis_vendor`
echo -e "Product Name:\t\t"`cat /sys/class/dmi/id/product_name`
echo -e "Version:\t\t"`cat /sys/class/dmi/id/product_version`
echo -e "Serial Number:\t\t"`cat /sys/class/dmi/id/product_serial`
echo -e "Machine Type:\t\t"`vserver=$(lscpu | grep Hypervisor | wc -l); if [ $vserver -gt 0 ]; then echo "VM"; else echo "Physical"; fi`
echo -e "Operating System:\t"`hostnamectl | grep "Operating System" | cut -d ' ' -f5-`
echo -e "Kernel:\t\t\t"`uname -r`
echo -e "Architecture:\t\t"`arch`
echo -e "Processor Name:\t\t"`awk -F':' '/^model name/ {print $2}' /proc/cpuinfo | uniq | sed -e 's/^[ \t]*//'`
echo -e "Active User:\t\t"`w | cut -d ' ' -f1 | grep -v USER | xargs -n1`
echo -e "System Main IP:\t\t"`hostname -I`
echo ""
echo -e "-------------------------------CPU/Memory Usage------------------------------"
echo -e "Memory Usage:\t"`free | awk '/Mem/{printf("%.2f%"), $3/$2*100}'`
echo -e "Swap Usage:\t"`free | awk '/Swap/{printf("%.2f%"), $3/$2*100}'`
echo -e "CPU Usage:\t"`cat /proc/stat | awk '/cpu/{printf("%.2f%\n"), ($2+$4)*100/($2+$4+$5)}' | awk '{print $0}' | head -1`
echo ""
echo -e "-------------------------------Disk Usage >80%-------------------------------"
df -Ph | sed s/%//g | awk '{ if($5 > 80) print $0;}'
echo ""
echo -e "-------------------------------For WWN Details-------------------------------"
vserver=$(lscpu | grep Hypervisor | wc -l)
if [ $vserver -gt 0 ]
then
echo "$(hostname) is a VM"
else
cat /sys/class/fc_host/host?/port_name
fi
echo ""
build-geekery_cn:
needs: check-os
runs-on: ubuntu-latest
steps:
- name: 拉源码
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: 安装 pnpm
uses: pnpm/action-setup@v4
with:
run_install: true
version: 9
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip' # caching pip dependencies
cache-dependency-path: "requirements.txt"
- name: 安装python依赖
run: pip install -r requirements.txt
- name: 生成图云
run: python main.py
- name: 设置 Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm
- name: 添加状态页面
run: |-
sed -i 's/关于我/内容分发网络部署状态/g' src/.vuepress/navbar.ts
sed -i 's/link:.*me.md\",/link: \"https:\/\/cloudflare-cloudnative-pages.geekery.cn\/\",/g' src/.vuepress/navbar.ts
sed -i 's/address-card/diagram-project/g' src/.vuepress/navbar.ts
- name: 构建文档
env:
NODE_OPTIONS: --max_old_space_size=8192
run: |-
pnpm run docs:build
> src/.vuepress/dist/.nojekyll
- name: 部署文档
uses: JamesIves/github-pages-deploy-action@v4
with:
# 这是文档部署到的分支名称
branch: geekery_cn-pages
folder: src/.vuepress/dist
- name: 登陆到DockerHub
uses: docker/login-action@v2
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: assets for docker
run: |
cp -rvf src/.vuepress/dist ./file
echo "TAG=geekery_cn-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: 构建和推送主域名docker镜像
uses: docker/[email protected]
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ vars.DOCKERHUB_USERNAME }}/notebook:${{ env.TAG }}
# build-github-pages:
# runs-on: ubuntu-latest
# needs: check-os
# steps:
# - name: 拉源码
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
# # 如果你文档需要 Git 子模块,取消注释下一行
# submodules: true
# - name: 安装 pnpm
# uses: pnpm/action-setup@v4
# with:
# run_install: true
# version: 9
# - uses: actions/setup-python@v4
# with:
# python-version: '3.11'
# cache: 'pip' # caching pip dependencies
# cache-dependency-path: "requirements.txt"
# - name: 安装python依赖
# run: pip install -r requirements.txt
# - name: 生成图云
# run: python main.py
# - name: 设置 Node.js
# uses: actions/setup-node@v3
# with:
# node-version: 20
# cache: pnpm
# - name: 更改主机名
# run: |-
# sed -i 's/hostname: "https:\/\/paper-dragon.github.io",/hostname: "https:\/\/www.geekery.cn",/g' src/.vuepress/theme.ts
# grep hostname src/.vuepress/theme.ts
# - name: 添加状态页面
# run: |-
# sed -i 's/关于我/内容分发网络部署状态/g' src/.vuepress/navbar.ts
# sed -i 's/link:.*me.md\",/link: \"https:\/\/cloudflare-cloudnative-pages.geekery.cn\/\",/g' src/.vuepress/navbar.ts
# sed -i 's/address-card/diagram-project/g' src/.vuepress/navbar.ts
# - name: 构建文档
# env:
# NODE_OPTIONS: --max_old_space_size=8192
# run: |-
# pnpm run docs:build
# > src/.vuepress/dist/.nojekyll
# - name: 部署文档
# uses: JamesIves/github-pages-deploy-action@v4
# with:
# # 这是文档部署到的分支名称
# branch: gh-pages
# folder: src/.vuepress/dist