3131 - name : Check out git repository
3232 uses : actions/checkout@main
3333
34+ # 安装JRE
3435 - name : Install JRE
3536 uses : actions/setup-java@main
3637 with :
3940 java-package : " jre"
4041 architecture : ${{ matrix.arch }}
4142
43+ # 开放TLS
4244 - name : Enable TLS 1.0 and 1.1 in java.security
4345 run : |
4446 if [ "$RUNNER_OS" = "Windows" ]; then
5355 RUNNER_OS : ${{ runner.os }}
5456 JAVA_HOME : ${{ env.JAVA_HOME }}
5557
58+ # JRE拷贝到前端静态目录
5659 - name : Copy JRE to static directory
5760 run : |
5861 mkdir -p chat2db-client/static/jre
@@ -64,56 +67,62 @@ jobs:
6467 env :
6568 JAVA_HOME : ${{ env.JAVA_HOME }}
6669
70+ # Linux中删除jre中相关文件
71+ - if : ${{ runner.os == 'Linux' }}
72+ name : Delete File on Linux
73+ run : |
74+ cd chat2db-client/static/jre/
75+ ls -la
76+ rm -rf legal
77+ ls -la
78+
79+ # 安装Node.js
6780 - name : Install Node.js
6881 uses : actions/setup-node@main
6982 with :
7083 node-version : " 16"
7184 # cache: "yarn"
7285 # cache-dependency-path: chat2db-client/yarn.lock
7386
87+ # 安装Java
7488 - name : Install Java and Maven
7589 uses : actions/setup-java@main
7690 with :
7791 java-version : " 17"
7892 distribution : " temurin"
7993 cache : " maven"
8094
95+ # 从缓存中拿去前端依赖
8196 - name : Cache node modules
8297 id : cache-npm
8398 uses : actions/cache@v3
8499 env :
85100 cache-name : cache-node-modules
86101 with :
87102 path : ~/.npm
88- key : ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json ') }}
103+ key : ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock ') }}
89104 restore-keys : |
90105 ${{ runner.os }}-build-${{ env.cache-name }}-
91106 ${{ runner.os }}-build-
92107 ${{ runner.os }}-
93108
109+ # 安装前端依赖
94110 - if : ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
95- name : List the state of node modules
111+ name : Yarn install
96112 continue-on-error : true
97113 run : |
98114 cd chat2db-client
99115 yarn install --frozen-lockfile
100116
117+ # 打包Web前端资源
101118 - name : Build FE Static
102119 run : |
103120 cd chat2db-client
104121 yarn run build:web:prod --app_version=99.0.${{ github.run_id }} --app_port=10822
105122 cp -r dist ../chat2db-server/chat2db-server-start/src/main/resources/static/front
106123 cp -r dist/index.html ../chat2db-server/chat2db-server-start/src/main/resources/thymeleaf/
107124
108- # Linux
109- - if : ${{ runner.os == 'Linux' }}
110- name : Delete File
111- run : |
112- cd chat2db-client/static/jre/
113- ls -la
114- rm -rf legal
115- ls -la
116-
125+ # 打包后端工程 & 发送到前端
117126 - name : Build BE Static
118127 run : |
119128 mvn clean package -B '-Dmaven.test.skip=true' -f chat2db-server/pom.xml
@@ -122,13 +131,15 @@ jobs:
122131 cp -r chat2db-client/version chat2db-client/versions/
123132 cp chat2db-server/chat2db-server-start/target/chat2db-server-start.jar chat2db-client/versions/99.0.${{ github.run_id }}/static/
124133
134+ # 打包桌面端前端资源
125135 - name : Prepare Build Electron
126136 run : |
127137 cd chat2db-client
128138 yarn run build:web:desktop --app_version=99.0.${{ github.run_id }} --app_port=10822
129139 cp -r dist ./versions/99.0.${{ github.run_id }}/
130140 rm -r dist
131141
142+ # 打包Electron
132143 - name : Build/release Electron app
133144 uses : samuelmeuli/action-electron-builder@v1
134145 with :
@@ -145,7 +156,7 @@ jobs:
145156 -c.extraMetadata.version=99.0.${{ github.run_id }}-Test
146157 ${{ matrix.build_arg}}
147158
148- # Only for macOS x86_64
159+ # 公证&签名 Mac App
149160 - name : Notarize MacOS x86_64 App
150161 if : matrix.os == 'macos-latest' && matrix.arch == 'x86_64'
151162 run : |
@@ -165,23 +176,25 @@ jobs:
165176 cd static/ && zip -r chat2db-server-start.zip ./
166177 cp -r chat2db-server-start.zip ../../../../oss_temp_file
167178
179+ # 准备发往OSS的文件
168180 - name : Prepare upload for OSS
169181 run : |
170182 mkdir -p oss_temp_file
171183 cp -r chat2db-client/release/*${{ matrix.file_extension }} ./oss_temp_file
172184
185+ # 设置OSS
173186 - name : Set up oss utils
174187 uses : yizhoumo/setup-ossutil@v1
175188 with :
176189 endpoint : " oss-accelerate.aliyuncs.com"
177190 access-key-id : ${{ secrets.OSS_ACCESS_KEY_ID }}
178191 access-key-secret : ${{ secrets.OSS_ACCESS_KEY_SECRET }}
179192 ossutil-version : " 1.7.16"
180-
193+ # 上传到OSS
181194 - name : Upload to OSS
182195 run : |
183196 ossutil cp -rf --acl=public-read ./oss_temp_file/ oss://chat2db-client/test/99.0.${{ github.run_id }}/
184-
197+ # 发送到DingTalk
185198 - name : Send dingtalk message
186199 uses : ghostoy/dingtalk-action@master
187200 with :
0 commit comments