Skip to content

Commit

Permalink
feat:support download task
Browse files Browse the repository at this point in the history
  • Loading branch information
Chat2DB-Pro committed Oct 29, 2024
1 parent 85b9925 commit cb4fb97
Showing 1 changed file with 37 additions and 52 deletions.
89 changes: 37 additions & 52 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
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
# 一共需要3台电脑运行
# windows
# macos-latest x86_64
# macos-latest arm64
Expand All @@ -31,21 +31,21 @@ jobs:
- name: Check out git repository
uses: actions/checkout@main

# Obtaining the version number is not supported by workflow, so a plug-in is used.
# 获取版本号 workflow不支持 所以用插件
- 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
# 安装jre Windows
- name: Install Jre for Windows
if: ${{ runner.os == 'Windows' }}
uses: actions/setup-java@main
Expand All @@ -54,7 +54,7 @@ jobs:
distribution: "temurin"
java-package: "jre"

# Install jre MacOS X64
# 安装jre MacOS X64
- name: Install Jre MacOS X64
if: ${{ runner.os == 'macOS' && matrix.arch == 'x86_64' }}
uses: actions/setup-java@main
Expand All @@ -63,7 +63,7 @@ jobs:
distribution: "temurin"
java-package: "jre"

# Install jre MacOS arm64
# 安装jre MacOS arm64
- name: Install Jre MacOS arm64
if: ${{ runner.os == 'macOS' && matrix.arch == 'arm64' }}
uses: actions/setup-java@main
Expand All @@ -73,7 +73,7 @@ jobs:
java-package: "jre"
architecture: "aarch64"

# Install jre Linux
# 安装jre Linux
- name: Install Jre for Linux
if: ${{ runner.os == 'Linux' }}
uses: actions/setup-java@main
Expand All @@ -82,73 +82,58 @@ jobs:
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"
# 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
# 开放TLS
- name: Enable TLS 1.0 and 1.1 in java.security
# 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: |
if [ "$RUNNER_OS" = "Windows" ]; then
sed -i "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\(TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" "$JAVA_HOME/conf/security/java.security"
elif [ "$RUNNER_OS" = "Linux" ]; then
sed -i "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\(TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" "$JAVA_HOME/conf/security/java.security"
elif [ "$RUNNER_OS" = "macOS" ]; then
sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\(TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" "$JAVA_HOME/conf/security/java.security"
fi
shell: bash
env:
RUNNER_OS: ${{ runner.os }}
JAVA_HOME: ${{ env.JAVA_HOME }}

# Copy jre Windows
sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" $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
# Copy jre macOS
# 复制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
# 复制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
# 安装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
# 安装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
Expand All @@ -160,7 +145,7 @@ jobs:
yarn
yarn run build
# Compile server-side java version
# 编译服务端java版本
- name: Build Java
run: mvn clean package -B '-Dmaven.test.skip=true' -f chat2db-server/pom.xml

Expand All @@ -175,7 +160,7 @@ jobs:
echo -n ${{ steps.chat2db_version.outputs.substring }} > version
cp -r version ./versions/
# Copy server-side java to the specified location
# 复制服务端java 到指定位置
- name: Copy App
run: |
cp chat2db-server/chat2db-server-start/target/chat2db-server-start.jar chat2db-client/versions/${{ steps.chat2db_version.outputs.substring }}/static/
Expand Down Expand Up @@ -220,7 +205,7 @@ jobs:
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' }}
Expand Down Expand Up @@ -260,14 +245,14 @@ jobs:
args: "-c.extraMetadata.version=${{ steps.chat2db_version.outputs.substring }} --linux"
release: true

# Prepare the required data Windows
# 准备要需要的数据 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
# 准备要需要的数据 MacOS x86_64
- name: Prepare upload for MacOS x86_64
if: ${{ runner.os == 'macOS' && matrix.arch == 'x86_64' }}
run: |
Expand All @@ -280,21 +265,21 @@ jobs:
cd static/ && zip -r chat2db-server-start.zip ./
cp -r chat2db-server-start.zip ../../../../oss_temp_file
# Prepare the required data MacOS arm64
# 准备要需要的数据 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
# 准备要需要的数据 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
# 把文件上传到OSS 方便下载
- name: Set up oss utils
uses: yizhoumo/setup-ossutil@v1
with:
Expand All @@ -306,7 +291,7 @@ jobs:
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
Expand All @@ -319,7 +304,7 @@ jobs:
"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
Expand All @@ -332,7 +317,7 @@ jobs:
"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
Expand All @@ -345,7 +330,7 @@ jobs:
"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
Expand Down

0 comments on commit cb4fb97

Please sign in to comment.