Skip to content

Commit cc7f28a

Browse files
committed
chore: Optimize action
1 parent f7c9df8 commit cc7f28a

1 file changed

Lines changed: 19 additions & 20 deletions

File tree

.github/workflows/release_test.yml

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ jobs:
1212
matrix:
1313
include:
1414
- os: windows-latest
15-
file_extension: '.exe'
15+
file_extension: ".exe"
1616
- os: macos-latest
1717
arch: x86_64
18-
file_extension: '.dmg'
18+
file_extension: ".dmg"
1919
- os: macos-latest
2020
arch: arm64
21-
file_extension: '.dmg'
21+
file_extension: ".dmg"
2222
- os: ubuntu-latest
23-
file_extension: '.AppImage'
23+
file_extension: ".AppImage"
2424
runs-on: ${{ matrix.os }}
2525

2626
steps:
@@ -30,47 +30,46 @@ jobs:
3030
- name: Install JRE
3131
uses: actions/setup-java@main
3232
with:
33-
java-version: '17'
34-
distribution: 'temurin'
35-
java-package: 'jre'
33+
java-version: "17"
34+
distribution: "temurin"
35+
java-package: "jre"
3636
architecture: ${{ matrix.arch }}
3737

3838
- name: Enable TLS 1.0 and 1.1 in java.security
3939
run: |
40-
if [[ "$RUNNER_OS" == "Windows" ]]; then
41-
# Windows 使用 Git Bash,其 sed 命令与 Linux 类似
42-
sed -i "s/jdk.tls.disabledAlgorithms=.*TLSv1, TLSv1.1,/jdk.tls.disabledAlgorithms=/" "${JAVA_HOME}/conf/security/java.security"
40+
if [[ "${{ runner.os }}" == "Windows" ]]; then
41+
sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" $JAVA_HOME/conf/security/java.security
42+
elseif [[ "${{ runner.os }}" == "Linux" ]]; then
43+
sed -i "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" $JAVA_HOME/conf/security/java.security
4344
else
44-
# macOS 和 Linux 使用相同的 sed 语法
45-
sed -i '' "s/jdk.tls.disabledAlgorithms=.*TLSv1, TLSv1.1,/jdk.tls.disabledAlgorithms=/" "${JAVA_HOME}/conf/security/java.security"
45+
sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" $JAVA_HOME/conf/security/java.security
4646
fi
4747
env:
4848
JAVA_HOME: ${{ env.JAVA_HOME }}
49-
shell: bash
49+
shell: bash
5050

5151
- name: Copy JRE to static directory
5252
run: |
5353
mkdir -p chat2db-client/static/jre
5454
cp -r "${JAVA_HOME}" chat2db-client/static/jre
55-
if [[ "$RUNNER_OS" == "Linux" || "$RUNNER_OS" == "macOS" ]]; then
55+
if [[ "${{ runner.os }}" != "Windows" ]]; then
5656
chmod -R 777 chat2db-client/static/jre
5757
fi
58-
shell: bash
5958
env:
6059
JAVA_HOME: ${{ runner.os == 'Windows' && env.JAVA_HOME }} || $JAVA_HOME
61-
60+
6261
- name: Install Node.js
6362
uses: actions/setup-node@main
6463
with:
65-
node-version: '16'
64+
node-version: "16"
6665
cache: "yarn"
6766
cache-dependency-path: chat2db-client/yarn.lock
6867

6968
- name: Install Java and Maven
7069
uses: actions/setup-java@main
7170
with:
72-
java-version: '17'
73-
distribution: 'temurin'
71+
java-version: "17"
72+
distribution: "temurin"
7473
cache: "maven"
7574

7675
- name: Build and Copy Artifacts
@@ -124,7 +123,7 @@ jobs:
124123
cd chat2db-client/versions/99.0.${{ github.run_id }}/ && zip -r 99.0.${{ github.run_id }}.zip ./
125124
cp -r 99.0.${{ github.run_id }}.zip ../../../oss_temp_file
126125
cd static/ && zip -r chat2db-server-start.zip ./
127-
cp -r chat2db-server-start.zip ../../../../oss_temp_file
126+
cp -r chat2db-server-start.zip ../../../../oss_temp_file
128127
129128
- name: Prepare upload for OSS
130129
run: |

0 commit comments

Comments
 (0)