Fix snapshot version detection in release workflow - #491
Merged
Conversation
The "Get snapshot versions" step read each package's new version via `pnpm view <pkg> dist-tags.alpha` immediately after `changeset publish`. npm's registry can lag a few seconds behind a publish before the new dist-tag is visible to a read, so this consistently reported the alpha version from a previous snapshot run instead of the one just published. Verified against a recent run (#433): it published gcg-typescript-resolver-files@0.0.0-pr490-run433-1-... but the comment reported 0.0.0-pr487-run427-1-... from three days earlier, even though querying the registry later returns the correct, freshly published tag. Fix: read the version straight from each package's local package.json when it was actually published this run (its version already matches the run's snapshot tag prefix, written by `changeset version --snapshot`) instead of round-tripping through the registry. Packages untouched by the PR's changesets (not published this run) still fall back to `pnpm view` to report their current alpha tag.
|
Contributor
|
❌ No permission to release snapshot |
Clarify what the %% and ## parameter expansions do when splitting each "pkg:dir" entry.
Previously, packages not touched by the PR's changesets still got a line in the comment via a `pnpm view` fallback, showing a stale version from an unrelated prior run. Now they're left out of the comment entirely instead.
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
Updated the release workflow to reliably detect and report snapshot versions of packages published during the current
/release-snapshotrun, addressing a race condition where npm's dist-tags could return stale data — and to only report packages that were actually published this run.Key Changes
package.jsonfiles instead ofpnpm viewdist-tagsPACKAGESarray to enable local version lookupsRELEASE_TAGenvironment variable to the step for version pattern matchingpkg/dirstring-splitting expansionsImplementation Details
pnpm view/npm's dist-tags can lag a few seconds behind a publish, potentially returning the previous alpha version instead of the newly published one0.0.0-{RELEASE_TAG}-*), we can confidently use it without waiting for registry propagationpnpm viewfallbackhttps://claude.ai/code/session_01CauycheykQG78cB3zFfAYJ