@@ -93,13 +93,25 @@ jobs:
9393 working-directory : ${{ env.WORKING_DIR }}
9494 run : npm run build -- --target ${{ matrix.target }}
9595
96- - name : Upload artifact
96+ - name : Upload native binary
9797 uses : actions/upload-artifact@v7
9898 with :
9999 name : bindings-${{ matrix.build_name }}
100100 path : ${{ env.WORKING_DIR }}/*.node
101101 if-no-files-found : error
102102
103+ # index.js and index.d.ts are generated by napi build and are
104+ # platform-independent, so we only need to upload them once.
105+ - name : Upload JS bindings
106+ if : matrix.build_name == 'linux-x64-gnu'
107+ uses : actions/upload-artifact@v7
108+ with :
109+ name : js-bindings
110+ path : |
111+ ${{ env.WORKING_DIR }}/index.js
112+ ${{ env.WORKING_DIR }}/index.d.ts
113+ if-no-files-found : error
114+
103115 publish :
104116 needs : build
105117 runs-on : [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd"]
@@ -141,6 +153,12 @@ jobs:
141153 name : bindings-win32-x64-msvc
142154 path : ${{ env.WORKING_DIR }}/artifacts/win32-x64-msvc
143155
156+ - name : Download JS bindings
157+ uses : actions/download-artifact@v8
158+ with :
159+ name : js-bindings
160+ path : ${{ env.WORKING_DIR }}/js-bindings
161+
144162 - name : List artifacts
145163 run : ls -la ${{ env.WORKING_DIR }}/artifacts/*/
146164
@@ -186,11 +204,14 @@ jobs:
186204 env :
187205 VERSION : ${{ inputs.version }}
188206
189- - name : Generate JS bindings (index.js and index.d.ts)
207+ - name : Install JS bindings (index.js and index.d.ts)
190208 working-directory : ${{ env.WORKING_DIR }}
191209 run : |
192- # napi prepublish generates index.js and index.d.ts from the .node artifacts
193- npx napi prepublish -t npm --skip-optional-publish --no-gh-release
210+ # index.js and index.d.ts are generated by napi build and uploaded
211+ # from the linux-x64-gnu build job.
212+ ls -la js-bindings/
213+ mv js-bindings/index.js index.js
214+ mv js-bindings/index.d.ts index.d.ts
194215 ls -la index.js index.d.ts
195216
196217 - name : Validate packages
0 commit comments