Skip to content

Commit 4705e51

Browse files
chore(node-ffi): upgrade napi and streamline build pipeline (#877)
* upgrade napi and streamline build pipeline * update lock file * chore: update livekit-ffi-node-bindings version to 0.12.46 * update build process * also add native package changes * fix output path * wip no TS * check in generated files * update artifacts command * update lock file * fix initial files * downgrade * re-export protobuf type * bump * dev version * bump * fix workflow * run bump on macos * try again * bump livekit-ffi-node-binding version * typo * bump livekit-ffi-node-binding version * fix fetching * bump livekit-ffi-node-binding version * update js bindings for release * skip cache in first job * temp no git check * better commit access * bump livekit-ffi-node-binding version * long commit sha * bump livekit-ffi-node-binding version * prevent detached head state * bump livekit-ffi-node-binding version * update js bindings for release * bump livekit-ffi-node-binding version * update js bindings for release * publish as latest --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 9a928b8 commit 4705e51

62 files changed

Lines changed: 20620 additions & 20110 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/node-builds.yml

Lines changed: 75 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,46 @@ env:
2222
APP_NAME: rtc-node
2323

2424
jobs:
25+
bump_version:
26+
runs-on: macos-15
27+
outputs:
28+
commit_sha: ${{ steps.commit.outputs.commit_long_sha }}
29+
steps:
30+
- uses: actions/checkout@v6
31+
32+
- uses: pnpm/action-setup@v4
33+
with:
34+
package_json_file: livekit-ffi-node-bindings/package.json
35+
36+
- name: Setup node
37+
uses: actions/setup-node@v6
38+
with:
39+
node-version: 24
40+
cache: pnpm
41+
cache-dependency-path: livekit-ffi-node-bindings/pnpm-lock.yaml
42+
43+
- working-directory: livekit-ffi-node-bindings
44+
run: pnpm install
45+
46+
- name: Set package version from tag
47+
working-directory: livekit-ffi-node-bindings
48+
run: |
49+
# Extract version from tag (e.g., rust-sdks/livekit-ffi@0.12.43 -> 0.12.43)
50+
VERSION=$(echo "${{ env.TAG_NAME }}" | sed 's/.*@//')
51+
echo "Setting package version to $VERSION"
52+
npm version $VERSION --no-git-tag-version
53+
pnpm run ci:version
54+
55+
- name: Add changes
56+
id: commit
57+
uses: EndBug/add-and-commit@v9
58+
with:
59+
add: '["**/package.json"]'
60+
default_author: github_actions
61+
message: bump livekit-ffi-node-binding version
62+
2563
build:
64+
needs: bump_version
2665
strategy:
2766
fail-fast: false
2867
matrix:
@@ -55,6 +94,8 @@ jobs:
5594
- uses: actions/checkout@v6
5695
with:
5796
submodules: recursive
97+
ref: ${{ needs.bump_version.outputs.commit_sha }}
98+
fetch-depth: 0
5899
- uses: pnpm/action-setup@v4
59100
with:
60101
package_json_file: livekit-ffi-node-bindings/package.json
@@ -147,20 +188,32 @@ jobs:
147188
working-directory: livekit-ffi-node-bindings
148189
run: pnpm build --target ${{ matrix.target }}
149190

150-
- name: Upload artifact
191+
- name: Upload binary artifact
151192
uses: actions/upload-artifact@v4
152193
if: github.event_name != 'pull-request'
153194
with:
154-
name: bindings-${{ matrix.target }}
155-
path: livekit-ffi-node-bindings/src/napi/${{ env.APP_NAME }}.*.node
195+
name: native-bindings-${{ matrix.target }}
196+
path: livekit-ffi-node-bindings/${{ env.APP_NAME }}.*.node
156197
if-no-files-found: error
157198

158-
release:
159-
needs: build
160-
name: Release
199+
- name: Upload JS
200+
uses: actions/upload-artifact@v4
201+
if: ${{ github.event_name != 'pull-request' && matrix.os == 'macos-15' }}
202+
with:
203+
name: js-bindings
204+
path: livekit-ffi-node-bindings/native.*
205+
if-no-files-found: error
206+
207+
commit_and_release:
208+
needs: [bump_version, build]
209+
name: Commit and Release
161210
runs-on: ubuntu-latest
162211
steps:
163-
- uses: actions/checkout@v5
212+
- uses: actions/checkout@v6
213+
214+
- run: git fetch origin ${{ needs.bump_version.outputs.commit_sha }}
215+
216+
- run: git reset --hard ${{ needs.bump_version.outputs.commit_sha }}
164217

165218
- uses: pnpm/action-setup@v4
166219
with:
@@ -176,40 +229,27 @@ jobs:
176229
- working-directory: livekit-ffi-node-bindings
177230
run: pnpm install
178231

179-
- name: Install Protoc
180-
uses: arduino/setup-protoc@v3
181-
with:
182-
version: "25.1"
183-
repo-token: ${{ secrets.GITHUB_TOKEN }}
184-
185-
- name: Download all artifacts
232+
- name: Download native build artifacts
186233
uses: actions/download-artifact@v4
187234
with:
235+
pattern: native-bindings-*
188236
path: livekit-ffi-node-bindings/artifacts
189237

190-
- name: Set package version from tag
191-
working-directory: livekit-ffi-node-bindings
192-
run: |
193-
# Extract version from tag (e.g., rust-sdks/livekit-ffi@0.12.43 -> 0.12.43)
194-
VERSION=$(echo "${{ env.TAG_NAME }}" | sed 's/.*@//')
195-
echo "Setting package version to $VERSION"
196-
npm version $VERSION --no-git-tag-version
197-
pnpm run version
198-
199-
- name: Commit and push versioning changes
200-
run: |
201-
git config --global user.name "github-actions[bot]"
202-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
203-
git add .
204-
git commit -m "chore: update livekit-ffi-node-bindings version to $(echo "${{ env.TAG_NAME }}" | sed 's/.*@//')" || echo "No changes to commit"
205-
git push origin HEAD
238+
- name: Download js artifacts
239+
uses: actions/download-artifact@v4
240+
with:
241+
name: js-bindings
242+
path: livekit-ffi-node-bindings
206243

207-
- name: Build TS parts
208-
working-directory: livekit-ffi-node-bindings
209-
run: pnpm build:ts
244+
- name: Add changes
245+
uses: EndBug/add-and-commit@v9
246+
with:
247+
add: '["livekit-ffi-node-bindings/native.js", "livekit-ffi-node-bindings/native.d.ts"]'
248+
default_author: github_actions
249+
message: update js bindings for release
210250

211251
- name: Move artifacts
212-
run: pnpm artifacts
252+
run: pnpm run ci:artifacts
213253
working-directory: livekit-ffi-node-bindings
214254

215255
- name: List packages
@@ -218,4 +258,4 @@ jobs:
218258

219259
- name: Publish
220260
working-directory: livekit-ffi-node-bindings
221-
run: pnpm publish --tag dev
261+
run: pnpm publish -r

Cargo.lock

Lines changed: 59 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

livekit-ffi-node-bindings/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ dist
123123
.AppleDouble
124124
.LSOverride
125125

126-
# Icon must end with two
126+
# Icon must end with two
127127
Icon
128128

129129

livekit-ffi-node-bindings/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ publish = false
88
crate-type = ["cdylib"]
99

1010
[dependencies]
11-
napi = { version = "2.12.2", default-features = false, features = [
11+
napi = { version = "3.8.2", default-features = false, features = [
12+
"compat-mode",
1213
"async",
1314
"napi6",
1415
] }
15-
napi-derive = "2.12.2"
16+
napi-derive = "3.5.1"
1617
livekit-ffi = { path = "../livekit-ffi" }
1718
prost = { workspace = true }
1819
prost-types = { workspace = true }

0 commit comments

Comments
 (0)