Skip to content

Commit 2b37da4

Browse files
committed
ci: fix prebuild workflow to handle submodules and publish
1 parent d23da7c commit 2b37da4

File tree

1 file changed

+54
-15
lines changed

1 file changed

+54
-15
lines changed

.github/workflows/prebuild.yml

Lines changed: 54 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,60 @@ name: Build Prebuilds
22

33
on:
44
push:
5-
branches:
6-
- main
7-
- master
8-
- 'fix/**'
9-
pull_request:
5+
branches: [main, master]
106
workflow_dispatch:
117

12-
concurrency:
13-
group: ${{github.workflow}}-${{github.ref}}
14-
cancel-in-progress: true
15-
168
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
9+
build:
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest, macos-latest]
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
submodules: recursive
19+
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: 22
23+
24+
- run: npm install
25+
- run: npx prebuildify --napi --strip || echo "Prebuildify failed, prebuilds may already exist"
26+
27+
- uses: actions/upload-artifact@v4
28+
with:
29+
name: prebuilds-${{ matrix.os }}
30+
path: prebuilds/
31+
if-no-files-found: ignore
32+
33+
publish:
34+
needs: build
35+
runs-on: ubuntu-latest
36+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
37+
38+
steps:
39+
- uses: actions/checkout@v4
40+
with:
41+
submodules: recursive
42+
43+
- uses: actions/setup-node@v4
44+
with:
45+
node-version: 22
46+
registry-url: https://registry.npmjs.org
47+
48+
- uses: actions/download-artifact@v4
49+
with:
50+
path: artifacts
51+
52+
- run: |
53+
mkdir -p prebuilds
54+
find artifacts -name "*.node" -exec sh -c 'cp "$1" prebuilds/$(basename $(dirname "$1"))/' _ {} \;
55+
56+
- run: npm install
57+
- run: npm version patch
58+
- run: git push && git push --tags
59+
- run: npm publish --access public
60+
env:
61+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)