Skip to content

Commit

Permalink
Merge pull request #806 from chat2db/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
JerryFan626 committed Nov 12, 2023
2 parents 7b14711 + 143cad7 commit bae5bcf
Show file tree
Hide file tree
Showing 25 changed files with 768 additions and 533 deletions.
331 changes: 331 additions & 0 deletions .github/workflows/release_test copy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,331 @@
# Workflow's name
name: Build Test Client

# Workflow's trigger
# 在release_test 分支收到推送的时候触发
on:
push:
branches:
- "release_test"
- "release_test_2"
- "release_test_3"

# Workflow's jobs
# 一共需要3台电脑运行
# 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

# 安装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"

# 安装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"

# 安装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"

# 安装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 开放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"
# java.security 开放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
# java.security 开放tls1 Linux
- name: Enable tls1
if: ${{ runner.os == 'Linux' }}
run: |
sed -i "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" ${{ env.JAVA_HOME }}/conf/security/java.security
# 复制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
# 复制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/
# 复制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/
# 安装node
- name: Install Node.js
uses: actions/setup-node@main
with:
node-version: 16
cache: "yarn"
cache-dependency-path: chat2db-client/yarn.lock

# 安装java
- name: Install Java and Maven
uses: actions/setup-java@main
with:
java-version: "17"
distribution: "temurin"
cache: "maven"

# 构建静态文件信息
- name: Yarn install & build & copy
run: |
cd chat2db-client
yarn install
yarn run build:web:prod --app_version=99.0.${{ github.run_id }} --app_port=10822
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/
# 编译服务端java版本
- 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/99.0.${{ github.run_id }}
mkdir versions/99.0.${{ github.run_id }}/static
touch version
echo -n 99.0.${{ github.run_id }} > version
cp -r version ./versions/
# 复制服务端java 到指定位置
- name: Copy App
run: |
cp chat2db-server/chat2db-server-start/target/chat2db-server-start.jar chat2db-client/versions/99.0.${{ github.run_id }}/static/
# cp -r chat2db-server/chat2db-server-start/target/lib chat2db-client/versions/99.0.${{ github.run_id }}/static/lib

- name: Prepare Build Electron
run: |
cd chat2db-client
yarn run build:web:desktop --app_version=99.0.${{ github.run_id }} --app_port=10822
cp -r dist ./versions/99.0.${{ github.run_id }}/
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.appId=com.chat2db.test -c.productName=Chat2DB-Test -c.win.publisherName=Chat2DB-Test -c.nsis.shortcutName=Chat2DB-Test -c.extraMetadata.version=99.0.${{ github.run_id }}-Test --win --x64"

# 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.appId=com.chat2db.test -c.productName=Chat2DB-Test -c.nsis.shortcutName=Chat2DB-Test -c.extraMetadata.version=99.0.${{ github.run_id }}-Test --mac --x64"

# 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-Test-99.0.${{ github.run_id }}-Test.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.appId=com.chat2db.test -c.productName=Chat2DB-Test -c.nsis.shortcutName=Chat2DB-Test -c.extraMetadata.version=99.0.${{ github.run_id }}-Test --mac --arm64"

# 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-Test-99.0.${{ github.run_id }}-Test-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.appId=com.chat2db.test -c.productName=test -c.nsis.shortcutName=test -c.extraMetadata.version=99.1.${{ github.run_id }} --linux"

# 准备要需要的数据 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
# 准备要需要的数据 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/99.0.${{ github.run_id }}/static/chat2db-server-start.jar ./oss_temp_file
cp -r chat2db-client/release/*.dmg ./oss_temp_file
cp -r chat2db-client/versions/99.0.${{ github.run_id }}/dist ./oss_temp_file/dist
cd chat2db-client/versions/99.0.${{ github.run_id }}/ && zip -r 99.0.${{ github.run_id }}.zip ./
cp -r 99.0.${{ github.run_id }}.zip ../../../oss_temp_file
cd static/ && zip -r chat2db-server-start.zip ./
cp -r chat2db-server-start.zip ../../../../oss_temp_file
# 准备要需要的数据 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
# 准备要需要的数据 Linux
- name: Prepare upload for Linux
if: runner.os == 'Linux'
run: |
mkdir oss_temp_file
cp -r chat2db-client/release/*.AppImage ./oss_temp_file
# 把文件上传到OSS 方便下载
- 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/test/99.0.${{ github.run_id }}/
# 构建完成通知
- 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-test-打包完成通知",
"text": "# Windows-test-打包完成通知 \n ![bang](https://oss.sqlgpt.cn/static/bang100.gif) \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Windows下载地址:[https://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test%20Setup%2099.0.${{ github.run_id }}-Test.exe](https://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test%20Setup%2099.0.${{ github.run_id }}-Test.exe) "
}
# 构建完成通知
- 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-test-构建完成通知",
"text": "# MacOS-x86_64-test-打包完成通知 \n ![bang](https://oss.sqlgpt.cn/static/bang100.gif) \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Intel芯片下载地址:[https://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test-99.0.${{ github.run_id }}-Test.dmg](https://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test-99.0.${{ github.run_id }}-Test.dmg) \n ### jar包下载地址:[https://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/chat2db-server-start.zip](https://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/chat2db-server-start.zip) "
}
# 构建完成通知
- 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-test-构建完成通知",
"text": "# MacOS-arm64-test-打包完成通知 \n ![bang](https://oss.sqlgpt.cn/static/bang100.gif) \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Apple芯片下载地址:[https://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test-99.0.${{ github.run_id }}-Test-arm64.dmg](https://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test-99.0.${{ github.run_id }}-Test-arm64.dmg) "
}
# 构建完成通知
- 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/bang100.gif) \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Linux下载地址:[https://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test-99.0.${{ github.run_id }}-Test.AppImage](https://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test-99.0.${{ github.run_id }}-Test.AppImage) "
}
Loading

0 comments on commit bae5bcf

Please sign in to comment.