Repository navigation
257 lines (223 loc) · 8.04 KB
/
Copy pathrelease.yml
File metadata and controls
257 lines (223 loc) · 8.04 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
name: Build and Release
on:
workflow_dispatch:
jobs:
# ── 1. 初始化阶段:获取版本号和更新日志 ──────────────────────────────────────
init:
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.get_version.outputs.VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get version from config
id: get_version
run: |
VERSION=$(grep "version:" public/js/config.js | sed "s/.*'\(.*\)'.*/\1/")
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Detected version: $VERSION"
- name: Get Release Notes
run: |
awk '/^## v/ {if (p) exit; p=1} p' changelog.md > RELEASE_NOTES.md || cp changelog.md RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
echo "---" >> RELEASE_NOTES.md
echo "* 本次 BoleServer 版本由 @shellsec 维护构建 🚀" >> RELEASE_NOTES.md
- name: Upload metadata
uses: actions/upload-artifact@v4
with:
name: release-metadata
path: RELEASE_NOTES.md
# ── 2. 桌面端构建阶段:复用 electron-build 逻辑 ──────────────────────────────
build_desktop:
needs: init
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
platform: win
- os: macos-latest
platform: mac
- os: ubuntu-latest
platform: linux
runs-on: ${{ matrix.os }}
name: Build Desktop (${{ matrix.platform }})
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install Linux system deps
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libnotify-dev libnss3 libxss1 libasound2t64
- name: Install dependencies
run: npm ci
- name: Rebuild native modules
run: npx @electron/rebuild --version $(node -e "console.log(require('electron/package.json').version)")
env:
npm_config_build_from_source: true
- name: Build JS source
run: npm run electron:build
- name: Package Electron app
run: npx electron-builder --${{ matrix.platform }} --publish=never
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_IDENTITY_AUTO_DISCOVERY: false
# 复用我们之前调试好的分项目上传逻辑
- name: Win x64 Setup
if: matrix.platform == 'win'
uses: actions/upload-artifact@v4
with:
name: boleserver-win-x64-Setup
path: dist-electron/*x64 Setup.exe
- name: Win x86 Setup
if: matrix.platform == 'win'
uses: actions/upload-artifact@v4
with:
name: boleserver-win-x86-Setup
path: dist-electron/*ia32 Setup.exe
- name: Win arm64 Setup
if: matrix.platform == 'win'
uses: actions/upload-artifact@v4
with:
name: boleserver-win-arm64-Setup
path: dist-electron/*arm64 Setup.exe
- name: Win x64 Portable
if: matrix.platform == 'win'
uses: actions/upload-artifact@v4
with:
name: boleserver-win-x64-Portable
path: dist-electron/*x64 Portable.exe
- name: Win x86 Portable
if: matrix.platform == 'win'
uses: actions/upload-artifact@v4
with:
name: boleserver-win-x86-Portable
path: dist-electron/*ia32 Portable.exe
- name: Win arm64 Portable
if: matrix.platform == 'win'
uses: actions/upload-artifact@v4
with:
name: boleserver-win-arm64-Portable
path: dist-electron/*arm64 Portable.exe
- name: Mac x64 DMG
if: matrix.platform == 'mac'
uses: actions/upload-artifact@v4
with:
name: boleserver-mac-x64-dmg
path: dist-electron/*x64.dmg
- name: Mac arm64 DMG
if: matrix.platform == 'mac'
uses: actions/upload-artifact@v4
with:
name: boleserver-mac-arm64-dmg
path: dist-electron/*arm64.dmg
- name: Linux amd64 AppImage
if: matrix.platform == 'linux'
uses: actions/upload-artifact@v4
with:
name: boleserver-linux-amd64-AppImage
path: dist-electron/*x64.AppImage
- name: Linux arm64 AppImage
if: matrix.platform == 'linux'
uses: actions/upload-artifact@v4
with:
name: boleserver-linux-arm64-AppImage
path: dist-electron/*arm64.AppImage
- name: Linux armv7l AppImage
if: matrix.platform == 'linux'
uses: actions/upload-artifact@v4
with:
name: boleserver-linux-armv7l-AppImage
path: dist-electron/*armv7l.AppImage
- name: Linux amd64 Deb
if: matrix.platform == 'linux'
uses: actions/upload-artifact@v4
with:
name: boleserver-linux-amd64-deb
path: dist-electron/*amd64.deb
- name: Linux arm64 Deb
if: matrix.platform == 'linux'
uses: actions/upload-artifact@v4
with:
name: boleserver-linux-arm64-deb
path: dist-electron/*arm64.deb
- name: Linux armv7l Deb
if: matrix.platform == 'linux'
uses: actions/upload-artifact@v4
with:
name: boleserver-linux-armv7l-deb
path: dist-electron/*armv7l.deb
# ── 3. 服务端构建阶段:打包 Server Zip ──────────────────────────────────────
build_server:
needs: init
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install and Build
run: |
npm ci
node scripts/download-binary.js --all
npm run build
# 清理开发依赖,仅保留生产运行环境
rm -rf node_modules
npm ci --omit=dev
- name: Build and Zip Server
run: |
mkdir -p release/boleserver
cp -r server node_modules public scripts index.js package.json release/boleserver/
[ -f "config.js" ] && cp config.js release/boleserver/
cd release
zip -r boleserver-${{ needs.init.outputs.VERSION }}-server.zip boleserver
- name: Upload Server Zip
uses: actions/upload-artifact@v4
with:
name: boleserver-server-zip
path: release/*.zip
# ── 4. 发布阶段:汇总所有产物并创建 Release ──────────────────────────────────
publish:
needs: [init, build_desktop, build_server]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: release_assets
merge-multiple: true
- name: Delete existing release (Cleanup)
run: |
gh release delete ${{ needs.init.outputs.VERSION }} --yes --cleanup-tag || echo "Release not found"
sleep 5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ needs.init.outputs.VERSION }}
name: BoleServer ${{ needs.init.outputs.VERSION }}
body_path: release_assets/RELEASE_NOTES.md
files: |
release_assets/*.exe
release_assets/*.dmg
release_assets/*.AppImage
release_assets/*.deb
release_assets/*.zip
draft: false
prerelease: false
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}