From e68107bd86af0de716d9d7235fc026d3e17c161d Mon Sep 17 00:00:00 2001 From: Simon Davies Date: Wed, 8 Apr 2026 21:57:15 +0100 Subject: [PATCH] get rid of napi prepublish Signed-off-by: Simon Davies --- .github/workflows/npm-publish.yml | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 238e54b..d28c548 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -93,13 +93,25 @@ jobs: working-directory: ${{ env.WORKING_DIR }} run: npm run build -- --target ${{ matrix.target }} - - name: Upload artifact + - name: Upload native binary uses: actions/upload-artifact@v7 with: name: bindings-${{ matrix.build_name }} path: ${{ env.WORKING_DIR }}/*.node if-no-files-found: error + # index.js and index.d.ts are generated by napi build and are + # platform-independent, so we only need to upload them once. + - name: Upload JS bindings + if: matrix.build_name == 'linux-x64-gnu' + uses: actions/upload-artifact@v7 + with: + name: js-bindings + path: | + ${{ env.WORKING_DIR }}/index.js + ${{ env.WORKING_DIR }}/index.d.ts + if-no-files-found: error + publish: needs: build runs-on: [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd"] @@ -141,6 +153,12 @@ jobs: name: bindings-win32-x64-msvc path: ${{ env.WORKING_DIR }}/artifacts/win32-x64-msvc + - name: Download JS bindings + uses: actions/download-artifact@v8 + with: + name: js-bindings + path: ${{ env.WORKING_DIR }}/js-bindings + - name: List artifacts run: ls -la ${{ env.WORKING_DIR }}/artifacts/*/ @@ -186,11 +204,14 @@ jobs: env: VERSION: ${{ inputs.version }} - - name: Generate JS bindings (index.js and index.d.ts) + - name: Install JS bindings (index.js and index.d.ts) working-directory: ${{ env.WORKING_DIR }} run: | - # napi prepublish generates index.js and index.d.ts from the .node artifacts - npx napi prepublish -t npm --skip-optional-publish --no-gh-release + # index.js and index.d.ts are generated by napi build and uploaded + # from the linux-x64-gnu build job. + ls -la js-bindings/ + mv js-bindings/index.js index.js + mv js-bindings/index.d.ts index.d.ts ls -la index.js index.d.ts - name: Validate packages