Upload generated JS bindings from build step instead of napi pre-publish
napi pre-publish expects a version-bump commit message convention. Instead, upload index.js and index.d.ts generated by napi build as artifacts and copy them into the publish step. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
a802874f2b
commit
2eb78b8a56
@@ -49,13 +49,23 @@ jobs:
|
|||||||
working-directory: napi
|
working-directory: napi
|
||||||
run: bunx napi build --platform --release
|
run: bunx napi build --platform --release
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload native binary
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: bindings-${{ matrix.target }}
|
name: bindings-${{ matrix.target }}
|
||||||
path: napi/*.node
|
path: napi/*.node
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
|
- name: Upload generated JS bindings
|
||||||
|
if: matrix.target == 'x86_64-unknown-linux-gnu'
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: js-bindings
|
||||||
|
path: |
|
||||||
|
napi/index.js
|
||||||
|
napi/index.d.ts
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
name: Publish to npm
|
name: Publish to npm
|
||||||
needs: build
|
needs: build
|
||||||
@@ -76,23 +86,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: napi/artifacts
|
path: napi/artifacts
|
||||||
|
|
||||||
- uses: oven-sh/setup-bun@v2
|
|
||||||
with:
|
|
||||||
bun-version: latest
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
working-directory: napi
|
|
||||||
run: bun install
|
|
||||||
|
|
||||||
- name: Generate JS bindings
|
|
||||||
working-directory: napi
|
|
||||||
run: bunx napi pre-publish
|
|
||||||
|
|
||||||
- name: Collect binaries and publish
|
- name: Collect binaries and publish
|
||||||
working-directory: napi
|
working-directory: napi
|
||||||
run: |
|
run: |
|
||||||
# Copy all .node binaries into the package directory
|
|
||||||
cp artifacts/bindings-*/*.node .
|
cp artifacts/bindings-*/*.node .
|
||||||
|
cp artifacts/js-bindings/napi/index.js .
|
||||||
|
cp artifacts/js-bindings/napi/index.d.ts .
|
||||||
|
|
||||||
echo "=== Package contents ==="
|
echo "=== Package contents ==="
|
||||||
ls -la *.node index.js index.d.ts
|
ls -la *.node index.js index.d.ts
|
||||||
|
|||||||
Reference in New Issue
Block a user