[STG-2187] ci: single changeset publish in release workflow#2197
Open
shrey150 wants to merge 1 commit into
Open
[STG-2187] ci: single changeset publish in release workflow#2197shrey150 wants to merge 1 commit into
shrey150 wants to merge 1 commit into
Conversation
The Release workflow had two code paths that both published `browse`: the changesets action (`publish: pnpm run release` → `changeset publish`, which does NOT honor the `ignore` list) and a bespoke pnpm-pack/npm-publish step. When no core changesets were pending, both fired on a browse release and the second hit `403 cannot publish over the previously published versions` (npm read-after-write lag defeated the `npm view` guard), which also skipped the downstream core canary. Collapse to a single publisher: run `changeset publish` once in a dedicated "Publish to npm" step (before the changesets action switches branches), push the tags it creates, and reduce the changesets action to Version- Packages-PR creation only. `changeset publish` already produces a correct, provenance-signed browse artifact (workspace:* is rewritten to the real version — verified on the published browse@0.8.3), so the bespoke browse publish/tag steps are redundant and removed. The browse canary is re-gated inline (fires on CLI changes that aren't a version bump) since it no longer depends on the removed detection step. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Contributor
There was a problem hiding this comment.
No issues found across 1 file
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant GH as GitHub Actions
participant Check as Check Changesets
participant NPM as npm Registry
participant Publish as Publish to npm Step
participant Changesets as changesets/action
participant Canary as Browse Canary Step
Note over GH,Canary: Release workflow on push to main
GH->>Check: Check pending changesets
Check->>Check: Determine if changesets action should run
Check-->>GH: should_run flag
Note over GH,NPM: Sole publisher — runs before changesets action
GH->>Publish: Publish to npm (always on main)
Publish->>Publish: git config + pnpm run release
Note over Publish: changeset publish — publishes any package with local version ahead of npm
Publish->>NPM: npm publish browse@x (if bumped)
NPM-->>Publish: publish success
Publish->>Publish: git push origin --tags
Publish-->>GH: tags pushed
alt should_run == true
GH->>Changesets: Create Release Pull Request
Note over Changesets: Only creates Version Packages PR — publish is removed
Changesets-->>GH: PR created
end
GH->>Canary: Publish browse canary
Canary->>Canary: git checkout HEAD
alt Browse CLI files changed
Canary->>Canary: Check if browse version changed in this push
alt Version changed (browse was released)
Canary->>Canary: Skip canary (real version already published)
else Version unchanged
Canary->>Canary: Build and publish canary version
Canary->>NPM: npm publish browse@x-canary-hash
NPM-->>Canary: publish success
end
else No browse changes
Canary->>Canary: Skip canary
end
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
Releaseworkflow had two publishers forbrowse, and they raced — surfaced by run 27043820691 failing with403 cannot publish over the previously published versions: 0.8.3(browse@0.8.3 still shipped fine; the duplicate attempt is what went red, and it skipped the downstream core canary).Root cause: the changesets action ran
publish: pnpm run release(=changeset publish), andchangeset publishdoes not honor theignorelist (ignoregoverns versioning, not publishing) — so it publishedbrowselike any other public package. A separate bespokepnpm pack/npm publishstep then publishedbrowseagain. When no core changesets were pending, both fired on the same browse-release commit; npm's read-after-write lag defeated the bespoke step'snpm viewguard, yielding the 403.Fix — one publisher
Collapse to a single
changeset publish:pnpm run releaseonce, before the changesets action (which switches branches to open the Version-Packages PR), on the clean pushed commit. It publishes whatever was just versioned — core (after a Version-Packages PR merges) or browse (after arelease/browsePR merges) — exactly once, then pushes the tagschangeset publishcreates.publish:input removed).Core's publish path is unchanged in substance — it already went through
changeset publish; this just relocates that command to its own step and adds an explicit tag push (the action used to push tags).Why this is safe (verified empirically)
changeset publishmakes a correct browse pkgbrowse@0.8.3has@browserbasehq/stagehand: "3.5.0"—workspace:*rewritten by pnpm--provenanceNPM_TOKENanywhere), so provenance is automaticchangeset publishtags by default; core tags@browserbasehq/stagehand@3.5.0already exist; step addsgit push origin --tagschangeset publishis a no-op right now;evals/server-v3areprivate→ auto-skippedGITHUB_TOKENenvE2E Test Matrix
yaml.safe_loadof the workflowPublish to npm→Create Release Pull Request→ canaries).github/workflows/release.yml, +42/-68changeset publishdry state on current mainStaged rollout (the one thing inspection can't prove — a live publish): after merge, the next browse release (a low-stakes, independent bump) exercises the exact
changeset publishpath core will use. A green browse release de-risks the next core release by construction; core is never the first to traverse the new path.CI-only change — no changeset.
🤖 Generated with Claude Code
Summary by cubic
Switch the Release workflow to a single publisher using
changeset publishto prevent duplicatebrowsereleases and 403 errors. Addresses STG-2187.Bug Fixes
pnpm pack/npm publishpath forbrowsethat racedchangeset publish.Refactors
pnpm run releaseonmainbefore the changesets action and pushes tags.changesets/actionto Version-Packages PR creation only (nopublish:input).browsecanary to run only on CLI changes that aren’t a version bump.Written for commit 1a640af. Summary will update on new commits.