Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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/*/

Expand Down Expand Up @@ -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
Expand Down
Loading