Skip to content

ci: add npm publish workflow with cross-platform binary builds#26

Open
LeeroyHannigan wants to merge 1 commit into
mainfrom
ci/npm-publish
Open

ci: add npm publish workflow with cross-platform binary builds#26
LeeroyHannigan wants to merge 1 commit into
mainfrom
ci/npm-publish

Conversation

@LeeroyHannigan
Copy link
Copy Markdown
Collaborator

Add npm publish workflow for cross-platform binary distribution

Summary

Enables users to install and run ExtendDB via npm without needing Rust or building from source:

npx extenddb init
npx extenddb serve

How it works

Uses the same pattern as esbuild, Prisma, and Turbo:

  1. Platform packages (@extenddb/darwin-arm64, @extenddb/darwin-x64, @extenddb/linux-x64, @extenddb/linux-arm64) each contain a pre-built binary
  2. Main package (extenddb) is a thin wrapper that detects the platform and delegates to the correct binary
  3. npm's optionalDependencies ensures only the relevant platform package is downloaded

CI workflow

Triggered by a GitHub Release (from release-please):

  1. Cross-compiles for 4 targets in parallel using the GitHub Actions matrix
  2. Publishes platform packages first, then the main wrapper
  3. Version is derived from the release tag (v0.1.0 → 0.1.0)

Files added

.github/workflows/npm-publish.yml — CI workflow
npm/extenddb/ — Main wrapper package
npm/extenddb/bin/extenddb — Platform-detecting CLI launcher
npm/@extenddb/darwin-arm64/ — macOS Apple Silicon
npm/@extenddb/darwin-x64/ — macOS Intel
npm/@extenddb/linux-x64/ — Linux x64
npm/@extenddb/linux-arm64/ — Linux ARM64

Prerequisites

  • npm org @ExtendDB created on npmjs.com
  • NPM_TOKEN secret added to the repo (Automation token from npmjs.com)
  • release-please workflow merged (creates the GitHub Releases that trigger this)

Tested locally

Verified the wrapper correctly resolves and executes the platform binary:

$ node node_modules/.bin/extenddb version
extenddb 0.0.2
catalog 0.0.2 (postgres)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant