@@ -107,7 +107,7 @@ jobs:
107107 if : ${{ !matrix.settings.docker }}
108108 shell : bash
109109 - name : Upload artifact
110- uses : actions/upload-artifact@v3
110+ uses : actions/upload-artifact@v4
111111 with :
112112 name : bindings-${{ matrix.settings.target }}
113113 path : ${{ env.APP_NAME }}.*.node
@@ -123,9 +123,9 @@ jobs:
123123 - host : windows-latest
124124 target : x86_64-pc-windows-msvc
125125 node :
126- - ' 14'
127- - ' 16'
128126 - ' 18'
127+ - ' 20'
128+ - ' 21'
129129 runs-on : ${{ matrix.settings.host }}
130130 steps :
131131 - uses : actions/checkout@v3
@@ -138,7 +138,7 @@ jobs:
138138 - name : Install dependencies
139139 run : yarn install
140140 - name : Download artifacts
141- uses : actions/download-artifact@v3
141+ uses : actions/download-artifact@v4
142142 with :
143143 name : bindings-${{ matrix.settings.target }}
144144 path : .
@@ -155,9 +155,9 @@ jobs:
155155 fail-fast : false
156156 matrix :
157157 node :
158- - ' 14'
159- - ' 16'
160158 - ' 18'
159+ - ' 20'
160+ - ' 21'
161161 runs-on : ubuntu-latest
162162 steps :
163163 - uses : actions/checkout@v3
@@ -170,7 +170,7 @@ jobs:
170170 - name : Install dependencies
171171 run : yarn install
172172 - name : Download artifacts
173- uses : actions/download-artifact@v3
173+ uses : actions/download-artifact@v4
174174 with :
175175 name : bindings-x86_64-unknown-linux-gnu
176176 path : .
@@ -187,9 +187,9 @@ jobs:
187187 fail-fast : false
188188 matrix :
189189 node :
190- - ' 14'
191- - ' 16'
192190 - ' 18'
191+ - ' 20'
192+ - ' 21'
193193 runs-on : ubuntu-latest
194194 steps :
195195 - uses : actions/checkout@v3
@@ -204,7 +204,7 @@ jobs:
204204 yarn config set supportedArchitectures.libc "musl"
205205 yarn install
206206 - name : Download artifacts
207- uses : actions/download-artifact@v3
207+ uses : actions/download-artifact@v4
208208 with :
209209 name : bindings-x86_64-unknown-linux-musl
210210 path : .
@@ -231,7 +231,7 @@ jobs:
231231 - name : Install dependencies
232232 run : yarn install
233233 - name : Download all artifacts
234- uses : actions/download-artifact@v3
234+ uses : actions/download-artifact@v4
235235 with :
236236 path : artifacts
237237 - name : Move artifacts
@@ -241,17 +241,30 @@ jobs:
241241 shell : bash
242242 - name : Publish
243243 run : |
244- if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
245- then
246- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
247- npm publish --access public
248- elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+";
249- then
250- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
251- npm publish --tag next --access public
244+ # 获取 commit message(第一行 + 去空格)
245+ COMMIT_MSG=$(git log -1 --pretty=%B | head -n1 | xargs)
246+
247+ # 打印调试信息
248+ echo "Raw commit message:"
249+ git log -1 --pretty=%B | cat -A
250+
251+ echo "Trimmed commit message: '$COMMIT_MSG'"
252+
253+ # 检查是否完全匹配版本号格式
254+ if [[ "$COMMIT_MSG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
255+ echo "Matched latest pattern"
256+ TAG="latest"
257+ elif [[ "$COMMIT_MSG" =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
258+ echo "Matched next pattern"
259+ TAG="next"
252260 else
261+ echo "Not matched any pattern"
253262 echo "Not a release, skipping publish"
263+ exit 0
254264 fi
265+
266+ echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
267+ npm publish --tag $TAG --access public
255268 env :
256269 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
257270 NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
0 commit comments