Skip to content

chore: add pkg.pr.new preview package releases#3806

Merged
ericallam merged 2 commits into
mainfrom
feat/pkg-pr-new-preview-releases
Jun 2, 2026
Merged

chore: add pkg.pr.new preview package releases#3806
ericallam merged 2 commits into
mainfrom
feat/pkg-pr-new-preview-releases

Conversation

@ericallam
Copy link
Copy Markdown
Member

@ericallam ericallam commented Jun 2, 2026

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:

npm i https://pkg.pr.new/@trigger.dev/sdk@<sha>

This lets reviewers and users try a branch (SDK, CLI, core, etc.) before anything is released, separate from the changesets release, the manual --snapshot prerelease, 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 version field. If a preview shipped as 4.5.0-rc.4, a consumer who installed it would pin 4.5.0-rc.4 to the preview tarball in their lockfile/cache — and a later npm i @trigger.dev/sdk@4.5.0-rc.4 from 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.mjs runs before the build and rewrites every public package to a unique 0.0.0-preview-<sha>. The 0.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 means scripts/updateVersion.ts bakes the preview version into the runtime VERSION constant, so previews are self-identifying (trigger --version, the x-trigger-cli-version header, the MCP server version) instead of all reporting the RC version.

Sibling workspace: specifiers are relaxed to workspace:* so pnpm pack resolves them against the rewritten versions — packages/python pins peerDependencies as workspace:^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.

pnpm add https://pkg.pr.new/@trigger.dev/sdk@e4dfc59

Fork limitation

pkg.pr.new authenticates with a GitHub Actions OIDC token, which GitHub does not issue to pull_request workflows from forks. The push trigger therefore covers branches pushed to this repo (core team), not external fork PRs. Fork coverage would need a workflow_run two-stage setup; left out for now.

Notes

  • Pinned pkg-pr-new@0.0.75 (no Node engine constraint; Node 20 CI is fine).
  • pkg.pr.new #525 adds a built-in --previewVersion flag (still open). If it lands we can drop the version-rewrite half of the script, but we'd keep a pre-build stamp anyway so updateVersion.ts picks up the preview version (the flag rewrites at pack time, too late for the baked VERSION).

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.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 2, 2026

⚠️ No Changeset found

Latest commit: 4564920

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 2, 2026

Review Change Stack

Walkthrough

Adds 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 @trigger.dev packages, and publishes installable preview builds to pkg.pr.new via pkg-pr-new. package.json gains a devDependency on pkg-pr-new@0.0.75.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'chore: add pkg.pr.new preview package releases' is clear and directly describes the main change — adding continuous preview releases via pkg.pr.new.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed PR description comprehensively covers what, how, and context with technical details, testing implications, and GitHub App prerequisites.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/pkg-pr-new-preview-releases

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]

This comment was marked as resolved.

@ericallam ericallam marked this pull request as ready for review June 2, 2026 11:00
devin-ai-integration[bot]

This comment was marked as resolved.

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.
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 2, 2026

Open in StackBlitz

@trigger.dev/build

npm i https://pkg.pr.new/@trigger.dev/build@4564920

trigger.dev

npm i https://pkg.pr.new/trigger.dev@4564920

@trigger.dev/core

npm i https://pkg.pr.new/@trigger.dev/core@4564920

@trigger.dev/plugins

npm i https://pkg.pr.new/@trigger.dev/plugins@4564920

@trigger.dev/python

npm i https://pkg.pr.new/@trigger.dev/python@4564920

@trigger.dev/react-hooks

npm i https://pkg.pr.new/@trigger.dev/react-hooks@4564920

@trigger.dev/redis-worker

npm i https://pkg.pr.new/@trigger.dev/redis-worker@4564920

@trigger.dev/rsc

npm i https://pkg.pr.new/@trigger.dev/rsc@4564920

@trigger.dev/schema-to-json

npm i https://pkg.pr.new/@trigger.dev/schema-to-json@4564920

@trigger.dev/sdk

npm i https://pkg.pr.new/@trigger.dev/sdk@4564920

commit: 4564920

@ericallam ericallam merged commit 005d7e0 into main Jun 2, 2026
53 checks passed
@ericallam ericallam deleted the feat/pkg-pr-new-preview-releases branch June 2, 2026 14:20
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.

2 participants