-
Notifications
You must be signed in to change notification settings - Fork 242
279 lines (253 loc) · 11.3 KB
/
publish.yml
File metadata and controls
279 lines (253 loc) · 11.3 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
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
target:
description: '选择要构建的目标平台'
required: true
default: 'all'
type: choice
options:
- all
- win-cli
- win-desktop
- linux-x64
- linux-arm64
- macos-arm64
- macos-desktop-arm64
jobs:
build-and-release:
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: |
export ELECTRON_SKIP_BINARY_DOWNLOAD=1
npm install
cd src/webui/FE
npm install
- name: Build
run: |
npm run build
npm run build-webui
- name: Compress dist
run: |
sudo apt install zip -y
cd ./dist/
zip -r ../LLBot.zip ./*
- name: Compress for Windows Cli
if: ${{ github.event.inputs.target == 'all' || github.event.inputs.target == 'win-cli' || startsWith(github.ref, 'refs/tags/') }}
run: |
mkdir llbot-cli-win-x64
cd llbot-cli-win-x64
mkdir -p bin/llbot
cp ../dist/使用说明.txt ./
cp ../dist/更新日志.txt ./
cp -r ../dist/* bin/llbot/
wget https://github.com/linyuchen/PMHQ/releases/latest/download/pmhq-win-x64.zip
unzip pmhq-win-x64.zip
mkdir -p bin/pmhq
rm pmhq-win-x64.zip
mv pmhq-win-x64.exe bin/pmhq/pmhq.exe
mv pmhq.dll bin/pmhq/
wget https://github.com/LLOneBot/LuckyLillia.CLI/releases/latest/download/llbot-win-x64.exe
mv llbot-win-x64.exe llbot.exe
wget https://github.com/LLOneBot/exe/releases/latest/download/node.exe -O bin/llbot/node.exe
wget https://github.com/LLOneBot/exe/releases/latest/download/ffmpeg.exe -O bin/llbot/ffmpeg.exe
wget https://github.com/LLOneBot/exe/releases/latest/download/ffprobe.exe -O bin/llbot/ffprobe.exe
zip -r ../LLBot-CLI-win-x64.zip ./*
- name: Compress for Windows Desktop
if: ${{ github.event.inputs.target == 'all' || github.event.inputs.target == 'win-desktop' || startsWith(github.ref, 'refs/tags/') }}
run: |
mkdir llbot-desktop-win-x64
cd llbot-desktop-win-x64
mkdir -p bin/llbot
cp ../dist/使用说明.txt ./
cp ../dist/更新日志.txt ./
cp -r ../dist/* ./bin/llbot/
wget https://github.com/LLOneBot/LuckyLilliaDesktop.Avalonia/releases/latest/download/lucky-lillia-desktop-win-x64.zip
unzip lucky-lillia-desktop-win-x64.zip
rm lucky-lillia-desktop-win-x64.zip
mv lucky-lillia-desktop.exe llbot.exe
zip -r ../LLBot-Desktop-win-x64.zip ./*
- name: Compress for Linux CLI x64
if: ${{ github.event.inputs.target == 'all' || github.event.inputs.target == 'linux-x64' || startsWith(github.ref, 'refs/tags/') }}
run: |
mkdir llbot-cli-linux-x64
cd llbot-cli-linux-x64
mkdir -p bin/llbot
mkdir -p bin/pmhq
cp ../doc/使用说明-linux-cli.txt ./使用说明.txt
cp ../dist/更新日志.txt ./
cp -r ../dist/* ./bin/llbot/
wget https://github.com/linyuchen/PMHQ/releases/latest/download/pmhq-linux-x64.zip
unzip pmhq-linux-x64.zip
rm pmhq-linux-x64.zip
mv pmhq-linux-x64 bin/pmhq/pmhq
mv libpmhq.so bin/pmhq/
wget https://github.com/LLOneBot/exe/releases/latest/download/node-linux-x64 -O bin/llbot/node
wget https://github.com/LLOneBot/LuckyLillia.CLI/releases/latest/download/llbot-linux-x64 -O llbot
cp ../script/start-linux.sh ./start.sh
zip -r ../LLBot-CLI-linux-x64.zip ./*
- name: Compress for Linux CLI arm64
if: ${{ github.event.inputs.target == 'all' || github.event.inputs.target == 'linux-arm64' || startsWith(github.ref, 'refs/tags/') }}
run: |
mkdir llbot-cli-linux-arm64
cd llbot-cli-linux-arm64
mkdir -p bin/llbot
mkdir -p bin/pmhq
cp ../doc/使用说明-linux-cli.txt ./使用说明.txt
cp ../dist/更新日志.txt ./
cp -r ../dist/* ./bin/llbot/
wget https://github.com/linyuchen/PMHQ/releases/latest/download/pmhq-linux-arm64.zip
unzip pmhq-linux-arm64.zip
rm pmhq-linux-arm64.zip
mv pmhq-linux-arm64 bin/pmhq/pmhq
mv libpmhq.so bin/pmhq/
wget https://github.com/LLOneBot/exe/releases/latest/download/node-linux-arm64 -O bin/llbot/node
wget https://github.com/LLOneBot/LuckyLillia.CLI/releases/latest/download/llbot-linux-arm64 -O llbot
cp ../script/start-linux.sh ./start.sh
zip -r ../LLBot-CLI-linux-arm64.zip ./*
- name: Compress for macOS CLI arm64
if: ${{ github.event.inputs.target == 'all' || github.event.inputs.target == 'macos-arm64' || startsWith(github.ref, 'refs/tags/') }}
run: |
mkdir llbot-cli-macos-arm64
cd llbot-cli-macos-arm64
mkdir -p bin/llbot
mkdir -p bin/pmhq
cp ../doc/使用说明-macos-cli.txt ./使用说明.txt
cp ../script/start-mac.sh ./start.sh
cp ../dist/更新日志.txt ./
cp -r ../dist/* ./bin/llbot/
wget https://github.com/linyuchen/PMHQ/releases/latest/download/pmhq-macos-arm64.zip
unzip pmhq-macos-arm64.zip
rm pmhq-macos-arm64.zip
mv pmhq-macos-arm64 bin/pmhq/pmhq
mv libpmhq.dylib bin/pmhq/
wget https://github.com/LLOneBot/exe/releases/latest/download/node-darwin-arm64 -O bin/llbot/node
wget https://github.com/LLOneBot/LuckyLillia.CLI/releases/latest/download/llbot-macos-arm64 -O llbot
wget https://github.com/LLOneBot/exe/releases/download/0.0.0/QQ-macos.zip
unzip QQ-macos.zip -d bin/qq
rm QQ-macos.zip
tar -cJvf ../LLBot-CLI-macos-arm64.tar.xz ./*
- name: Compress for macOS Desktop arm64
if: ${{ github.event.inputs.target == 'all' || github.event.inputs.target == 'macos-desktop-arm64' || startsWith(github.ref, 'refs/tags/') }}
run: |
mkdir llbot-desktop-macos-arm64
cd llbot-desktop-macos-arm64
mkdir -p bin/llbot
cp ../doc/使用说明.txt ./使用说明.txt
cp ../dist/更新日志.txt ./
cp -r ../dist/* ./bin/llbot/
wget https://github.com/LLOneBot/LuckyLilliaDesktop.Avalonia/releases/latest/download/lucky-lillia-desktop-macos-arm64.tar.gz
tar -xzvf lucky-lillia-desktop-macos-arm64.tar.gz
rm lucky-lillia-desktop-macos-arm64.tar.gz
tar -cJvf ../LLBot-Desktop-macos-arm64.tar.xz ./*
- name: Compress for Docker
run: |
cp script/install-llbot-docker.sh LLBot-Docker.sh
# 手动触发时只上传 artifacts
- name: Upload LLBot.zip
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/upload-artifact@v4
with:
name: LLBot
path: LLBot.zip
retention-days: 30
- name: Upload LLBot-Desktop-win-x64.zip
if: ${{ !startsWith(github.ref, 'refs/tags/') && (github.event.inputs.target == 'all' || github.event.inputs.target == 'win-desktop') }}
uses: actions/upload-artifact@v4
with:
name: LLBot-Desktop-win-x64
path: LLBot-Desktop-win-x64.zip
retention-days: 30
- name: Upload LLBot-CLI-win-x64.zip
if: ${{ !startsWith(github.ref, 'refs/tags/') && (github.event.inputs.target == 'all' || github.event.inputs.target == 'win-cli') }}
uses: actions/upload-artifact@v4
with:
name: LLBot-CLI-win-x64
path: LLBot-CLI-win-x64.zip
retention-days: 30
- name: Upload LLBot-CLI-linux-x64.zip
if: ${{ !startsWith(github.ref, 'refs/tags/') && (github.event.inputs.target == 'all' || github.event.inputs.target == 'linux-x64') }}
uses: actions/upload-artifact@v4
with:
name: LLBot-CLI-linux-x64
path: LLBot-CLI-linux-x64.zip
retention-days: 30
- name: Upload LLBot-CLI-linux-arm64.zip
if: ${{ !startsWith(github.ref, 'refs/tags/') && (github.event.inputs.target == 'all' || github.event.inputs.target == 'linux-arm64') }}
uses: actions/upload-artifact@v4
with:
name: LLBot-CLI-linux-arm64
path: LLBot-CLI-linux-arm64.zip
retention-days: 30
- name: Upload LLBot-CLI-macos-arm64.tar.xz
if: ${{ !startsWith(github.ref, 'refs/tags/') && (github.event.inputs.target == 'all' || github.event.inputs.target == 'macos-arm64') }}
uses: actions/upload-artifact@v4
with:
name: LLBot-CLI-macos-arm64
path: LLBot-CLI-macos-arm64.tar.xz
retention-days: 30
- name: Upload LLBot-Desktop-macos-arm64.tar.xz
if: ${{ !startsWith(github.ref, 'refs/tags/') && (github.event.inputs.target == 'all' || github.event.inputs.target == 'macos-desktop-arm64') }}
uses: actions/upload-artifact@v4
with:
name: LLBot-Desktop-macos-arm64
path: LLBot-Desktop-macos-arm64.tar.xz
retention-days: 30
- name: Upload LLBot-Docker.sh
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/upload-artifact@v4
with:
name: LLBot-Docker
path: LLBot-Docker.sh
retention-days: 30
# tag 触发时创建 release
- name: Extract version from tag
if: startsWith(github.ref, 'refs/tags/')
id: get-version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
- name: Generate release body from changelog
if: startsWith(github.ref, 'refs/tags/')
id: changelog
run: |
# 取第一个分段
content="$(awk 'BEGIN{RS="=================";ORS=""} NR==1{print}' doc/更新日志.txt)"
# 去掉前两行
body="$(echo "$content" | tail -n +3)"
# 去除前后空白
body="$(echo "$body" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')"
# 输出到 GITHUB_OUTPUT
echo "BODY<<EOF" >> $GITHUB_OUTPUT
echo "$body" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: ncipollo/release-action@v1
with:
artifacts: 'LLBot.zip, LLBot-Desktop-win-x64.zip, LLBot-Desktop-macos-arm64.tar.xz, LLBot-CLI-win-x64.zip, LLBot-CLI-linux-x64.zip, LLBot-CLI-linux-arm64.zip, LLBot-CLI-macos-arm64.tar.xz, LLBot-Docker.sh'
draft: true
token: ${{ secrets.RELEASE_TOKEN }}
name: LuckyLilliaBot v${{ steps.get-version.outputs.VERSION }}
body: |
${{ steps.changelog.outputs.BODY }}
**Windows Desktop 版本只支持 Windows Server 2012 R2 / Windows 10 及以上版本**
- name: Publish to npm
if: startsWith(github.ref, 'refs/tags/')
run: |
npm install -g npm@latest
mv dist package
tar -czf llonebot-dist.tgz package/*
npm publish llonebot-dist.tgz --provenance