Skip to content

Commit 586e7df

Browse files
committed
ci: publish @ruv/rvcsi to npm on v* tags via OIDC Trusted Publishing
Same approach as the other ruvnet repos (e.g. Dossier's publish.yml): a `Publish to npm` workflow triggered by a `v*` tag, `id-token: write`, no NPM_TOKEN secret — npmjs.com is configured to trust this repo + workflow. Builds the napi-rs addon for the runner's platform (linux-x64-gnu) and `npm publish --access public`. Cross-platform prebuilds (a matrix + `napi prepublish`) are a follow-up. One-time setup needed on npmjs.com: register ruvnet/rvcsi + publish-npm.yml as a Trusted Publisher for @ruv/rvcsi, then push tag v0.3.1. Co-Authored-By: claude-flow <ruv@ruv.net>
1 parent 595fc24 commit 586e7df

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

.github/workflows/publish-npm.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Publish @ruv/rvcsi to npm when a version tag (v*) is pushed.
2+
#
3+
# Uses npm OIDC Trusted Publishing — no NPM_TOKEN secret. One-time setup on
4+
# npmjs.com: add this repo (ruvnet/rvcsi) + this workflow filename
5+
# (publish-npm.yml) as a Trusted Publisher for the @ruv/rvcsi package.
6+
# See https://docs.npmjs.com/trusted-publishers
7+
#
8+
# This builds the napi-rs native addon for the runner's platform only
9+
# (linux-x64-gnu) and publishes it as `latest`. A proper cross-platform release
10+
# (a build matrix + `napi prepublish` per-triple packages) is a follow-up.
11+
12+
name: Publish to npm
13+
14+
on:
15+
push:
16+
tags:
17+
- 'v*'
18+
workflow_dispatch: {}
19+
20+
permissions:
21+
id-token: write # required for npm OIDC (Trusted Publishers)
22+
contents: read
23+
24+
jobs:
25+
publish:
26+
runs-on: ubuntu-latest
27+
defaults:
28+
run:
29+
working-directory: crates/rvcsi-node
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- uses: dtolnay/rust-toolchain@stable
34+
- uses: Swatinem/rust-cache@v2
35+
with:
36+
workspaces: . -> target
37+
38+
- uses: actions/setup-node@v4
39+
with:
40+
node-version: '22' # Trusted Publishing needs Node 22.14+
41+
registry-url: 'https://registry.npmjs.org'
42+
43+
- name: Use latest npm (Trusted Publishing needs npm 11.5.1+)
44+
run: npm install -g npm@latest
45+
46+
- name: Install (@napi-rs/cli)
47+
run: npm install
48+
49+
- name: Build the native addon
50+
run: npm run build # napi build --platform --release --js binding.js --dts binding.d.ts
51+
52+
- name: Smoke test
53+
run: npm test
54+
55+
- name: Publish @ruv/rvcsi
56+
run: npm publish --access public
57+
# OIDC auth — the workflow must be registered as a Trusted Publisher on npm.

0 commit comments

Comments
 (0)