Skip to content

Commit a646ea2

Browse files
committed
fix: use custom prebuild workflow that calls npm run prebuildify
This ensures the --name node.napi flag is used, creating prebuilds with correct filenames that node-gyp-build can recognize.
1 parent b8d08fb commit a646ea2

File tree

1 file changed

+75
-7
lines changed

1 file changed

+75
-7
lines changed

.github/workflows/prebuild.yml

Lines changed: 75 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
branches:
66
- main
77
- master
8-
- 'fix/**'
98
pull_request:
109
workflow_dispatch:
1110

@@ -14,9 +13,78 @@ concurrency:
1413
cancel-in-progress: true
1514

1615
jobs:
17-
npm:
18-
uses: tree-sitter/workflows/.github/workflows/package-npm.yml@main
19-
secrets:
20-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
21-
with:
22-
generate: false
16+
build:
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- os: macos-14
22+
name: darwin-arm64
23+
- os: macos-13
24+
name: darwin-x64
25+
- os: ubuntu-22.04
26+
name: linux-x64
27+
- os: ubuntu-22.04
28+
name: linux-arm64
29+
- os: windows-2022
30+
name: win32-x64
31+
- os: windows-2022
32+
name: win32-arm64
33+
34+
runs-on: ${{ matrix.os }}
35+
name: Build ${{ matrix.name }}
36+
37+
steps:
38+
- name: Checkout code
39+
uses: actions/checkout@v4
40+
41+
- name: Setup Node.js
42+
uses: actions/setup-node@v4
43+
with:
44+
node-version: '20'
45+
46+
- name: Install dependencies
47+
run: npm install
48+
49+
- name: Build prebuild
50+
run: npm run prebuildify
51+
env:
52+
PREBUILD_ARCH: ${{ contains(matrix.name, 'arm64') && 'arm64' || 'x64' }}
53+
54+
- name: Upload prebuilds
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: prebuilds-${{ matrix.name }}
58+
path: prebuilds/
59+
retention-days: 1
60+
61+
publish:
62+
needs: build
63+
runs-on: ubuntu-latest
64+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
65+
66+
steps:
67+
- name: Checkout code
68+
uses: actions/checkout@v4
69+
70+
- name: Setup Node.js
71+
uses: actions/setup-node@v4
72+
with:
73+
node-version: '20'
74+
registry-url: 'https://registry.npmjs.org'
75+
76+
- name: Download all prebuilds
77+
uses: actions/download-artifact@v4
78+
with:
79+
path: prebuilds-temp
80+
81+
- name: Organize prebuilds
82+
run: |
83+
mkdir -p prebuilds
84+
cp -r prebuilds-temp/prebuilds-*/* prebuilds/
85+
ls -R prebuilds
86+
87+
- name: Publish to npm
88+
run: npm publish --access public
89+
env:
90+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)