chore: add pkg.pr.new preview package releases#3806
Conversation
Publishes installable preview builds of the public @trigger.dev/* packages for every branch push via pkg.pr.new, without touching the npm registry. Reviewers and users can install any branch with `npm i https://pkg.pr.new/@trigger.dev/sdk@<sha>`. A pre-build stamp rewrites each public package to a unique 0.0.0-preview-<sha> version so previews can never collide with real npm versions in consumer lockfiles/caches, and so updateVersion.ts bakes the preview version into the runtime VERSION constant. Sibling workspace specifiers are relaxed to workspace:* so pnpm pack resolves cleanly after the bump.
|
WalkthroughAdds a GitHub Actions workflow that, on pushes to non-main branches touching package/workspace files, checks out the repo, sets up pnpm/Node, installs deps, runs generate, stamps a unique preview semver using scripts/stamp-preview-version.mjs (based on the commit SHA), builds Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Add package.json and scripts/updateVersion.ts to the workflow path filter so a change to the version-baking logic (or root build inputs) doesn't silently skip a preview publish.
@trigger.dev/build
trigger.dev
@trigger.dev/core
@trigger.dev/plugins
@trigger.dev/python
@trigger.dev/react-hooks
@trigger.dev/redis-worker
@trigger.dev/rsc
@trigger.dev/schema-to-json
@trigger.dev/sdk
commit: |
What
Adds pkg.pr.new continuous preview releases. Every push to a branch builds the public
@trigger.dev/*packages and publishes installable preview builds keyed by commit SHA — without touching the npm registry. pkg.pr.new drops install instructions on the associated PR:This lets reviewers and users try a branch (SDK, CLI, core, etc.) before anything is released, separate from the changesets release, the manual
--snapshotprerelease, and the chat-prerelease flow.How
.github/workflows/preview-packages.yml(push trigger) → install → generate Prisma → stamp preview version → build →pkg-pr-new publish.The version stamp (the important part)
pkg.pr.new serves previews by SHA but does not rewrite the package.json
versionfield. If a preview shipped as4.5.0-rc.4, a consumer who installed it would pin4.5.0-rc.4to the preview tarball in their lockfile/cache — and a laternpm i @trigger.dev/sdk@4.5.0-rc.4from npm could resolve to the stale preview. This is a known, by-design gap in the tool (stackblitz-labs/pkg.pr.new#250, #390).scripts/stamp-preview-version.mjsruns before the build and rewrites every public package to a unique0.0.0-preview-<sha>. The0.0.0-prefix can never satisfy a real semver range, so the collision is structurally impossible (same convention React/Next canaries use). Running before the build also meansscripts/updateVersion.tsbakes the preview version into the runtimeVERSIONconstant, so previews are self-identifying (trigger --version, thex-trigger-cli-versionheader, the MCP server version) instead of all reporting the RC version.Sibling
workspace:specifiers are relaxed toworkspace:*sopnpm packresolves them against the rewritten versions —packages/pythonpins peerDependencies asworkspace:^4.5.0-rc.4, which would otherwise be unsatisfiable once the version changes. Non-public deps (@trigger.dev/database,@internal/*) are left untouched. All mutations happen on the ephemeral CI checkout; nothing is committed.GitHub App
The pkg.pr.new GitHub App is already installed on
triggerdotdev/trigger.dev(has been for a while), so no setup is needed. Confirmed live — this branch's pushes published all 10 public packages, e.g.Fork limitation
pkg.pr.new authenticates with a GitHub Actions OIDC token, which GitHub does not issue to
pull_requestworkflows from forks. Thepushtrigger therefore covers branches pushed to this repo (core team), not external fork PRs. Fork coverage would need aworkflow_runtwo-stage setup; left out for now.Notes
pkg-pr-new@0.0.75(no Node engine constraint; Node 20 CI is fine).--previewVersionflag (still open). If it lands we can drop the version-rewrite half of the script, but we'd keep a pre-build stamp anyway soupdateVersion.tspicks up the preview version (the flag rewrites at pack time, too late for the bakedVERSION).