-
Notifications
You must be signed in to change notification settings - Fork 1.9k
350 lines (313 loc) · 14.9 KB
/
release.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
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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# Workflow's name
name: Build Client
# Workflow's trigger
# Pack when creating tags
on:
push:
tags:
- v*
# Workflow's jobs
# A total of 3 computers are required to run
# windows
# macos-latest x86_64
# macos-latest arm64
jobs:
release:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
- os: macos-latest
arch: x86_64
- os: macos-latest
arch: arm64
- os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- name: Check out git repository
uses: actions/checkout@main
# Obtaining the version number is not supported by workflow, so a plug-in is used.
- name: Create version
id: chat2db_version
uses: bhowell2/[email protected]
with:
value: ${{ github.ref }}
index_of_str: "refs/tags/v"
# Output basic information
- name: Print basic information
run: |
echo "current environment: ${{ env.CHAT2DB_ENVIRONMENT }}"
echo "current version: ${{ steps.chat2db_version.outputs.substring }}"
# Install jre Windows
- name: Install Jre for Windows
if: ${{ runner.os == 'Windows' }}
uses: actions/setup-java@main
with:
java-version: "17"
distribution: "temurin"
java-package: "jre"
# Install jre MacOS X64
- name: Install Jre MacOS X64
if: ${{ runner.os == 'macOS' && matrix.arch == 'x86_64' }}
uses: actions/setup-java@main
with:
java-version: "17"
distribution: "temurin"
java-package: "jre"
architecture: "x64"
# Install jre MacOS arm64
- name: Install Jre MacOS arm64
if: ${{ runner.os == 'macOS' && matrix.arch == 'arm64' }}
uses: actions/setup-java@main
with:
java-version: "17"
distribution: "temurin"
java-package: "jre"
architecture: "aarch64"
# Install jre Linux
- name: Install Jre for Linux
if: ${{ runner.os == 'Linux' }}
uses: actions/setup-java@main
with:
java-version: "17"
distribution: "temurin"
java-package: "jre"
# java.security open tls1 Windows
- name: Enable tls1
if: ${{ runner.os == 'Windows' }}
run: |
# sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" "${{ env.JAVA_HOME }}\conf\security\java.security"
$filePath = "${{ env.JAVA_HOME }}\conf\security\java.security"
$content = Get-Content $filePath -Raw
$updatedContent = $content -replace '^(jdk.tls.disabledAlgorithms=)(.*)( TLSv1, TLSv1.1,)(.*)', '$1$2$4'
$updatedContent | Set-Content $filePath
shell: pwsh
# java.security open tls1 macOS
- name: Enable tls1
if: ${{ runner.os == 'macOS' }}
run: |
sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" $JAVA_HOME/conf/security/java.security
# Copy jre Windows
- name: Copy Jre for Windows
if: ${{ runner.os == 'Windows' }}
run: |
mkdir chat2db-client/static
cp -r "${{ env.JAVA_HOME }}" chat2db-client/static/jre
# Copy jre macOS
- name: Copy Jre for macOS
if: ${{ runner.os == 'macOS' }}
run: |
mkdir chat2db-client/static
cp -r $JAVA_HOME chat2db-client/static/jre
chmod -R 777 chat2db-client/static/jre/
# Copy jre Linux
- name: Copy Jre for Linux
if: ${{ runner.os == 'Linux' }}
run: |
mkdir chat2db-client/static
cp -r $JAVA_HOME chat2db-client/static/jre
chmod -R 777 chat2db-client/static/jre/
# Install node
- name: Install Node.js
uses: actions/setup-node@main
with:
node-version: 16
cache: "yarn"
cache-dependency-path: chat2db-client/yarn.lock
# Install java
- name: Install Java and Maven
uses: actions/setup-java@main
with:
java-version: "17"
distribution: "temurin"
cache: "maven"
# Build static file information
- name: Yarn install & build & copy
run: |
cd chat2db-client
yarn
yarn run build:web:prod --app_version=${{ steps.chat2db_version.outputs.substring }}
cp -r dist ../chat2db-server/chat2db-server-start/src/main/resources/static/front
cp -r dist/index.html ../chat2db-server/chat2db-server-start/src/main/resources/thymeleaf/
cd src/main
yarn
yarn run build
# Compile server-side java version
- name: Build Java
run: mvn clean package -B '-Dmaven.test.skip=true' -f chat2db-server/pom.xml
# touch versions
- name: touch versions
run: |
cd chat2db-client
mkdir versions
mkdir versions/${{ steps.chat2db_version.outputs.substring }}
mkdir versions/${{ steps.chat2db_version.outputs.substring }}/static
touch version
echo -n ${{ steps.chat2db_version.outputs.substring }} > version
cp -r version ./versions/
# Copy server-side java to the specified location
- name: Copy App
run: |
cp chat2db-server/chat2db-server-start/target/chat2db-server-start.jar chat2db-client/versions/${{ steps.chat2db_version.outputs.substring }}/static/
# cp -r chat2db-server/chat2db-server-start/target/lib chat2db-client/versions/${{ steps.chat2db_version.outputs.substring }}/static/lib
- name: Prepare Build Electron
run: |
cd chat2db-client
yarn run build:web:desktop --app_version=${{ steps.chat2db_version.outputs.substring }}
cp -r dist ./versions/${{ steps.chat2db_version.outputs.substring }}/
rm -r dist
# windows
- name: Build/release Electron app for Windows
if: ${{ runner.os == 'Windows' }}
uses: samuelmeuli/action-electron-builder@v1
with:
package_root: "chat2db-client/"
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
mac_certs: ${{ secrets.mac_certs }}
mac_certs_password: ${{ secrets.mac_certs_password }}
skip_build: true
args: "-c.extraMetadata.version=${{ steps.chat2db_version.outputs.substring }} --win --x64"
release: true
# macos x86_64
- name: Build/release Electron app for MacOS X64
if: ${{ runner.os == 'macOS' && matrix.arch == 'x86_64' }}
uses: samuelmeuli/action-electron-builder@v1
with:
package_root: "chat2db-client/"
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
mac_certs: ${{ secrets.mac_certs }}
mac_certs_password: ${{ secrets.mac_certs_password }}
skip_build: true
args: "-c.extraMetadata.version=${{ steps.chat2db_version.outputs.substring }} --mac --x64"
release: true
# x86_64 notarization
- name: Notarization x86_64 App
if: ${{ runner.os == 'macOS' && matrix.arch == 'x86_64' }}
run: |
xcrun notarytool store-credentials "Chat2DB" --apple-id "${{secrets.MAC_APPLE_ID}}" --password "${{secrets.MAC_APPLE_PASSWORD}}" --team-id "${{secrets.MAC_TEAM_ID}}"
xcrun notarytool submit chat2db-client/release/Chat2DB-${{ steps.chat2db_version.outputs.substring }}.dmg --keychain-profile "Chat2DB"
# macos arm64
- name: Build/release Electron app for MacOS arm64
if: ${{ runner.os == 'macOS' && matrix.arch == 'arm64' }}
uses: samuelmeuli/action-electron-builder@v1
with:
package_root: "chat2db-client/"
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
mac_certs: ${{ secrets.mac_certs }}
mac_certs_password: ${{ secrets.mac_certs_password }}
skip_build: true
args: "-c.extraMetadata.version=${{ steps.chat2db_version.outputs.substring }} --mac --arm64"
release: true
# arm notarization
- name: Notarization arm64 App
if: ${{ runner.os == 'macOS' && matrix.arch == 'arm64' }}
run: |
xcrun notarytool store-credentials "Chat2DB" --apple-id "${{secrets.MAC_APPLE_ID}}" --password "${{secrets.MAC_APPLE_PASSWORD}}" --team-id "${{secrets.MAC_TEAM_ID}}"
xcrun notarytool submit chat2db-client/release/Chat2DB-${{ steps.chat2db_version.outputs.substring }}-arm64.dmg --keychain-profile "Chat2DB"
# Linux
- name: Delete File
if: ${{ runner.os == 'Linux' }}
run: |
cd chat2db-client/static/jre/
ls -la
rm -rf legal
ls -la
- name: Build/release Electron app for Linux
if: ${{ runner.os == 'Linux' }}
uses: samuelmeuli/action-electron-builder@v1
with:
package_root: "chat2db-client/"
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
skip_build: true
args: "-c.extraMetadata.version=${{ steps.chat2db_version.outputs.substring }} --linux"
release: true
# Prepare the required data Windows
- name: Prepare upload for Windows
if: runner.os == 'Windows'
run: |
mkdir oss_temp_file
cp -r chat2db-client/release/*Setup*.exe ./oss_temp_file
# Prepare the required data MacOS x86_64
- name: Prepare upload for MacOS x86_64
if: ${{ runner.os == 'macOS' && matrix.arch == 'x86_64' }}
run: |
mkdir oss_temp_file
cp chat2db-client/versions/${{ steps.chat2db_version.outputs.substring }}/static/chat2db-server-start.jar ./oss_temp_file
cp -r chat2db-client/release/*.dmg ./oss_temp_file
cp -r chat2db-client/versions/${{ steps.chat2db_version.outputs.substring }}/dist ./oss_temp_file/dist
cd chat2db-client/versions/${{ steps.chat2db_version.outputs.substring }}/ && zip -r ${{ steps.chat2db_version.outputs.substring }}.zip ./
cp -r ${{ steps.chat2db_version.outputs.substring }}.zip ../../../oss_temp_file
cd static/ && zip -r chat2db-server-start.zip ./
cp -r chat2db-server-start.zip ../../../../oss_temp_file
# Prepare the required data MacOS arm64
- name: Prepare upload for MacOS arm64
if: ${{ runner.os == 'macOS' && matrix.arch == 'arm64' }}
run: |
mkdir oss_temp_file
cp -r chat2db-client/release/*.dmg ./oss_temp_file
# Prepare the required data Linux
- name: Prepare upload for Linux
if: runner.os == 'Linux'
run: |
mkdir oss_temp_file
cp -r chat2db-client/release/*.AppImage ./oss_temp_file
# Upload files to OSS for easy downloading
- name: Set up oss utils
uses: yizhoumo/setup-ossutil@v1
with:
endpoint: "oss-accelerate.aliyuncs.com"
access-key-id: ${{ secrets.OSS_ACCESS_KEY_ID }}
access-key-secret: ${{ secrets.OSS_ACCESS_KEY_SECRET }}
ossutil-version: "1.7.16"
- name: Upload to oss
run: |
ossutil cp -rf --acl=public-read ./oss_temp_file/ oss://chat2db-client/release/${{ steps.chat2db_version.outputs.substring }}/
# Build completion notification
- name: Send dingtalk message for Windows
if: ${{ runner.os == 'Windows' }}
uses: ghostoy/dingtalk-action@master
with:
webhook: ${{ secrets.DINGTALK_WEBHOOK }}
msgtype: markdown
content: |
{
"title": "Windows-release-打包完成通知",
"text": "# Windows-release-打包完成通知 \n ![bang](https://oss.sqlgpt.cn/static/happy100.jpg) \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Windows下载地址:[https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB%20Setup%20${{ steps.chat2db_version.outputs.substring }}.exe](https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB%20Setup%20${{ steps.chat2db_version.outputs.substring }}.exe) "
}
# Build completion notification
- name: Send dingtalk message for MacOS x86_64
if: ${{ runner.os == 'macOS' && matrix.arch == 'x86_64' }}
uses: ghostoy/dingtalk-action@master
with:
webhook: ${{ secrets.DINGTALK_WEBHOOK }}
msgtype: markdown
content: |
{
"title": "MacOS-x86_64-release-构建完成通知",
"text": "# MacOS-x86_64-release-打包完成通知 \n ![bang](https://oss.sqlgpt.cn/static/happy100.jpg) \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Intel芯片下载地址:[https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}.dmg](https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}.dmg) \n ### jar包下载地址:[https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/chat2db-server-start.zip](https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/chat2db-server-start.zip) "
}
# Build completion notification
- name: Send dingtalk message for MacOS arm64
if: ${{ runner.os == 'macOS' && matrix.arch == 'arm64' }}
uses: ghostoy/dingtalk-action@master
with:
webhook: ${{ secrets.DINGTALK_WEBHOOK }}
msgtype: markdown
content: |
{
"title": "MacOS-arm64-release-构建完成通知",
"text": "# MacOS-arm64-release-打包完成通知 \n ![bang](https://oss.sqlgpt.cn/static/happy100.jpg) \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Apple芯片下载地址:[https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}-arm64.dmg](https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}-arm64.dmg) "
}
# Build completion notification
- name: Send dingtalk message for Linux
if: ${{ runner.os == 'Linux' }}
uses: ghostoy/dingtalk-action@master
with:
webhook: ${{ secrets.DINGTALK_WEBHOOK }}
msgtype: markdown
content: |
{
"title": "Linux-test-打包完成通知",
"text": "# Linux-test-打包完成通知 \n ![bang](https://oss.sqlgpt.cn/static/happy100.jpg) \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Linux下载地址:[https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}.AppImage](https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}.AppImage)"
}