[STG-1739] fix: browse-cli releases publish under alpha instead of latest
Merged
SH
8mo ago+41+41+01234567890123456789-4-4-0123456789
Summary
- Root cause: The
changesets/actionstep corrupts git state by checking outchangeset-release/mainand creating a new commit. After it returns,HEADpoints to the wrong branch/commit. The browse-cli check step usesHEAD/HEAD^which are now wrong, so it always says "browse-cli version did not change" and skips the publish. Then the stagehand canary step (changeset publish --tag alpha) finds the unpublished version and publishes it underalphainstead oflatest. - Fix: Replace all
HEAD/HEAD^references with${{ github.sha }}/${{ github.sha }}^(the actual merge commit SHA, immune to branch switches). Addgit checkout ${{ github.sha }}to restore the working tree. Add explicit--tag latestto the publish command. - New: Add a browse-cli canary step that publishes
X.Y.Z-alpha-{sha}versions under thealphatag on feature branch merges (matching stagehand's existing canary pattern).
What was happening
- PR merged to main with browse-cli version bump (e.g. 0.3.0 -> 0.4.0)
changesets/actionruns, switches tochangeset-release/main, creates commitHEADnow points to the changeset PR commit, not the merge commit- browse-cli check compares wrong commits, finds no version change, sets
should_publish=false - Stagehand canary step runs
changeset publish --tag alpha, which picks up the unpublished browse-cli and publishes it underalpha - Result:
npm info @browserbasehq/browse-clishowslatest: 0.3.0,alpha: 0.4.0
What this PR does
- Uses
${{ github.sha }}(the actual merge commit) instead ofHEADfor all git comparisons - Adds
git checkout ${{ github.sha }}to restore the working tree after changesets/action - Adds
--tag latestto thenpm publishcommand for clean releases - Adds a new "Publish browse-cli canary" step for feature branch merges (publishes
X.Y.Z-alpha-{sha}underalphatag)
Validation
- Traced CI logs from recent releases to confirm
HEADwas pointing tochangeset-release/mainafter the changesets step - Confirmed
npm view @browserbasehq/browse-clishowslatest: 0.3.0whilealpha: 0.4.1(the bug in action) ${{ github.sha }}is set by GitHub Actions to the merge commit SHA and is immutable throughout the run
Linear
🤖 Generated with Claude Code
Summary by cubic
Fixes the release workflow so @browserbasehq/browse-cli clean releases publish to latest, and canaries publish to alpha. Addresses Linear STG-1739 by using the immutable merge SHA to avoid changesets/action HEAD switches.
-
Bug Fixes
- Use
${{ github.sha }}/${{ github.sha }}^for diffs and version reads to avoid wrongHEAD. - Restore the working tree before checks/publish and reset
packages/cli/package.jsonafter canary publish. - Publish clean releases with
npm publish ... --tag latest.
- Use
-
New Features
- Add canary step that publishes
X.Y.Z-alpha-{shortSha}toalphawhen CLI files changed but no clean release occurred. - Skip canary if the version already exists or no CLI changes are detected.
- Add canary step that publishes