@@ -250,8 +250,8 @@ jobs:
250
250
- name : Upload target-specific package for ${{ matrix.settings.target }}
251
251
uses : actions/upload-artifact@v4
252
252
with :
253
- name : package- ${{ matrix.settings.target }}
254
- path : npm
253
+ name : ${{ steps.fix-rpath.outputs.PLATFORM_ARCH }}
254
+ path : npm/${{ steps.fix-rpath.outputs.PLATFORM_ARCH }}
255
255
if-no-files-found : error
256
256
257
257
test-macOS-windows-binding :
@@ -297,12 +297,18 @@ jobs:
297
297
shell : bash
298
298
- name : Install dependencies
299
299
run : pnpm install
300
+ - name : Determine name of Node.js bindings target
301
+ id : node-target
302
+ shell : bash
303
+ run : |
304
+ OS="${{ contains(matrix.settings.target, 'darwin') && 'darwin' || 'win32' }}"
305
+ ARCH="${{ matrix.settings.architecture }}"
306
+ echo "TARGET=$OS-$ARCH" >> $GITHUB_OUTPUT
300
307
- name : Download target-specific package for ${{ matrix.settings.target }}
301
308
uses : actions/download-artifact@v4
302
309
with :
303
- name : package-${{ matrix.settings.target }}
304
- merge-multiple : true
305
- path : npm
310
+ name : ${{ steps.node-target.outputs.TARGET }}
311
+ path : npm/${{ steps.node-target.outputs.TARGET }}
306
312
- name : List packages
307
313
run : ls -R ./npm
308
314
shell : bash
@@ -359,12 +365,18 @@ jobs:
359
365
echo "PNPM_STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
360
366
- name : Install dependencies
361
367
run : pnpm install --force
368
+ - name : Determine name of Node.js bindings target
369
+ id : node-target
370
+ shell : bash
371
+ run : |
372
+ ARCH="${{ contains(matrix.target, 'x86_64') && 'x64' || 'arm64' }}"
373
+ LIBC="${{ contains(matrix.target, 'gnu') && 'gnu' || 'musl' }}"
374
+ echo "TARGET=linux-$ARCH-$LIBC" >> $GITHUB_OUTPUT
362
375
- name : Download target-specific package for ${{ matrix.target }}
363
376
uses : actions/download-artifact@v4
364
377
with :
365
- name : package-${{ matrix.target }}
366
- merge-multiple : true
367
- path : npm
378
+ name : ${{ steps.node-target.outputs.TARGET }}
379
+ path : npm/${{ steps.node-target.outputs.TARGET }}
368
380
- name : List packages
369
381
run : ls -R ./npm
370
382
shell : bash
@@ -381,89 +393,62 @@ jobs:
381
393
382
394
npm run test
383
395
384
- # universal-macOS:
385
- # name: Build universal macOS binary
386
- # needs:
387
- # - build
388
- # runs-on: macos-latest
389
- # steps:
390
- # - uses: actions/checkout@v4
391
- # - name: setup pnpm
392
- # uses: pnpm/action-setup@v4
393
- # with:
394
- # version: 10
395
- # - name: Setup node
396
- # uses: actions/setup-node@v4
397
- # with:
398
- # node-version: 20
399
- # cache: pnpm
400
- # - name: Install dependencies
401
- # run: pnpm install
402
- # - name: Download macOS x64 artifact
403
- # uses: actions/download-artifact@v4
404
- # with:
405
- # name: bindings-x86_64-apple-darwin
406
- # path: artifacts
407
- # - name: Download macOS arm64 artifact
408
- # uses: actions/download-artifact@v4
409
- # with:
410
- # name: bindings-aarch64-apple-darwin
411
- # path: artifacts
412
- # - name: Combine binaries
413
- # run: pnpm universal
414
- # - name: Upload artifact
415
- # uses: actions/upload-artifact@v4
416
- # with:
417
- # name: bindings-universal-apple-darwin
418
- # path: ${{ env.APP_NAME }}.*.node
419
- # if-no-files-found: error
420
-
421
- # publish:
422
- # name: Publish
423
- # runs-on: ubuntu-latest
424
- # needs:
425
- # - lint
426
- # - test-linux-binding
427
- # - test-macOS-windows-binding
428
- # # - universal-macOS
429
- # steps:
430
- # - uses: actions/checkout@v4
431
- # - name: setup pnpm
432
- # uses: pnpm/action-setup@v4
433
- # with:
434
- # version: 10
435
- # - name: Setup node
436
- # uses: actions/setup-node@v4
437
- # with:
438
- # node-version: 22
439
- # cache: pnpm
440
- # - name: Install dependencies
441
- # run: pnpm install
442
- # - name: Download all artifacts
443
- # uses: actions/download-artifact@v4
444
- # with:
445
- # path: artifacts
446
- # - name: create npm dirs
447
- # run: pnpm napi create-npm-dirs
448
- # - name: Move artifacts
449
- # run: pnpm artifacts
450
- # - name: List packages
451
- # run: ls -R ./npm
452
- # shell: bash
453
- # - name: Publish
454
- # run: |
455
- # npm config set provenance true
456
- # if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
457
- # then
458
- # echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
459
- # npm publish --access public
460
- # elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+";
461
- # then
462
- # echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
463
- # npm publish --tag next --access public
464
- # else
465
- # echo "Not a release, skipping publish"
466
- # fi
467
- # env:
468
- # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
469
- # NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
396
+ publish :
397
+ name : Publish a release
398
+ environment : release
399
+ runs-on : ubuntu-latest
400
+ if : ${{ (github.head_ref || github.ref_name) == 'main' }}
401
+ needs :
402
+ - test-linux-binding
403
+ - test-macOS-windows-binding
404
+ steps :
405
+ - uses : actions/checkout@v4
406
+ - name : setup pnpm
407
+ uses : pnpm/action-setup@v4
408
+ with :
409
+ version : 10
410
+ - name : Setup node
411
+ uses : actions/setup-node@v4
412
+ with :
413
+ node-version : 22
414
+ registry-url : https://registry.npmjs.org
415
+ cache : pnpm
416
+ - name : Install dependencies
417
+ run : pnpm install
418
+ # - name: Clear npm directory
419
+ # shell: bash
420
+ # run: rm -rf npm/*
421
+ - name : Download all artifacts
422
+ uses : actions/download-artifact@v4
423
+ with :
424
+ path : npm/
425
+ - name : List packages
426
+ run : ls -R ./npm
427
+ shell : bash
428
+ - name : Publish Dev
429
+ shell : bash
430
+ env :
431
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
432
+ NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
433
+ run : |
434
+ npm publish --provenance --tag dev
435
+
436
+ # TODO: Maybe restrict by branch, not just commit format?
437
+ # TODO: Enable this when we're ready to go public.
438
+ # - name: Publish
439
+ # run: |
440
+ # npm config set provenance true
441
+ # if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
442
+ # then
443
+ # echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
444
+ # npm publish # --access public
445
+ # elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+";
446
+ # then
447
+ # echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
448
+ # npm publish --tag next # --access public
449
+ # else
450
+ # echo "Not a release, skipping publish"
451
+ # fi
452
+ # env:
453
+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
454
+ # NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
0 commit comments