@@ -266,3 +266,84 @@ jobs:
266266 if : steps.check.outputs.skip != 'true'
267267 working-directory : packages/buckaroo-js-core
268268 run : npm publish --access public --provenance --loglevel=verbose
269+
270+ release-npm-duckdb-node :
271+ name : Publish buckaroo-duckdb-node to npm
272+ needs : release
273+ if : needs.release.result == 'success'
274+ # GitHub-hosted runner required: npm Trusted Publishing OIDC is only
275+ # supported on github-hosted runners (Depot's depot-ubuntu-latest is
276+ # treated as self-hosted and won't receive npm OIDC credentials).
277+ runs-on : ubuntu-latest
278+ timeout-minutes : 10
279+ environment : npm
280+ permissions :
281+ contents : read
282+ id-token : write
283+ steps :
284+ - name : Checkout
285+ uses : actions/checkout@v7
286+
287+ - name : Setup pnpm
288+ uses : pnpm/action-setup@v6
289+ with :
290+ version : 9.10.0
291+
292+ - name : Setup Node.js with npm registry
293+ uses : actions/setup-node@v6
294+ with :
295+ registry-url : ' https://registry.npmjs.org'
296+ cache : ' pnpm'
297+ cache-dependency-path : ' packages/pnpm-lock.yaml'
298+
299+ - name : Install pnpm dependencies
300+ working-directory : packages
301+ run : pnpm install --frozen-lockfile
302+
303+ - name : Upgrade npm to a Trusted-Publishing-capable version
304+ # Trusted Publishing requires npm >= 11.5.1. The global npm dir
305+ # on github-hosted runners is root-owned, so sudo is needed.
306+ run : sudo npm install -g npm@11.5.1
307+
308+ - name : OIDC diagnostics (compare against npm Trusted Publisher config)
309+ # NOTE: the npm Trusted Publisher on npmjs.com must be configured to
310+ # point to "release.yml" (not "release-buckaroo-duckdb-node.yml").
311+ # See https://www.npmjs.com/package/buckaroo-duckdb-node/access
312+ run : |
313+ echo "npm version: $(npm --version)"
314+ echo "GITHUB_REPOSITORY: ${GITHUB_REPOSITORY}"
315+ echo "GITHUB_WORKFLOW_REF: ${GITHUB_WORKFLOW_REF}"
316+ echo "GITHUB_REF: ${GITHUB_REF}"
317+ echo "GITHUB_REF_NAME: ${GITHUB_REF_NAME}"
318+ echo "GITHUB_JOB: ${GITHUB_JOB}"
319+ echo "Job environment (yaml): npm"
320+ echo
321+ echo "On npmjs.com the Trusted Publisher must match:"
322+ echo " Owner: $(echo "${GITHUB_REPOSITORY}" | cut -d/ -f1)"
323+ echo " Repository: $(echo "${GITHUB_REPOSITORY}" | cut -d/ -f2)"
324+ echo " Workflow: $(basename "${GITHUB_WORKFLOW_REF%@*}")"
325+ echo " Environment: npm (or leave blank if no environment configured)"
326+
327+ - name : Set buckaroo-duckdb-node version to ${{ needs.release.outputs.version }}
328+ working-directory : packages/buckaroo-duckdb-node
329+ run : npm version "${{ needs.release.outputs.version }}" --no-git-tag-version --allow-same-version
330+
331+ - name : Build buckaroo-duckdb-node
332+ working-directory : packages/buckaroo-duckdb-node
333+ run : pnpm run build
334+
335+ - name : Check if version already published
336+ id : check
337+ run : |
338+ VERSION="${{ needs.release.outputs.version }}"
339+ if npm view "buckaroo-duckdb-node@${VERSION}" version >/dev/null 2>&1; then
340+ echo "buckaroo-duckdb-node@${VERSION} already on npm — skipping publish."
341+ echo "skip=true" >> "$GITHUB_OUTPUT"
342+ else
343+ echo "skip=false" >> "$GITHUB_OUTPUT"
344+ fi
345+
346+ - name : Publish to npm (Trusted Publishing + provenance)
347+ if : steps.check.outputs.skip != 'true'
348+ working-directory : packages/buckaroo-duckdb-node
349+ run : npm publish --access public --provenance --loglevel=verbose
0 commit comments