Repository navigation
Update package version after an unfinished publish - #74413
Conversation
tyxla
left a comment
There was a problem hiding this comment.
👍
How do we prevent this from happening again?
I wonder if it would make sense to have some checks built into the publish script where it looks to the published npm version as the source of truth rather than what's local? That's a lot of remote calls and could be quite slow, but in the case we're going to be publishing to npm anyways, it feels important to be correct. |
|
Changesets is a good and battle tested tool that handles the versioning and the release stuff pretty well. May be we can explore using it. |
|
Size Change: 0 B Total Size: 3.08 MB ℹ️ View Unchanged
|
Ideally the whole operation would be atomic. The script makes local changes, commits them, then publishes packages to NPM and pushes the new commits to GitHub. Either the NPM and GitHub operations both succeed or they both fail. But here the NPM publishing succeeded and then the GitHub push failed. The push failed because there were conflicts in the What's bad that the GitHub action run did these commits only locally, they were lost after the run ended. A better workflow would be:
Here the only failure mode is that after successful NPM publishing merging to |
|
Once the versions are updated or even merged to trunk, publishing should ideally be done from trunk. That is the approach used by tools like Changesets. Once set up,
If the CI errs, it's easy to publish them from trunk or re-run the CI job. It works on the assumption that the trunk is always in the releasable state because it creates the release branch from the trunk. There is a large list of projects that use the tool. |
This fixes a mismatch in our package versions. On Dec 23 2024 @priethor published the
latestversion of Gutenberg packages in this action run: https://github.com/WordPress/gutenberg/actions/runs/20462309747/job/58797649853But this action run didn't finish successfully. It succeeded actually publishing the packages to NPM, but then failed to commit to
trunkthe changes topackage.jsonversion fields and to changelogs. As a result, the git repo has no traces of packages being published. And there is a mismatch. For example, the latest@wordpress/dataon NPM is 10.37.0, but in the git repo it's still 10.36.0.Another bad consequence is that development
nextpackages are published with the old version number, for example as10.36.1-next.76cff8c98.0, although an earlierlatestpackage is already10.37.0.This causes chaos for consumers like Jetpack (Automattic/jetpack#46397) where specifying a version
^10.36.1-next.76cff8c98.0doesn't match the specifiednextversion, because the older10.37.0is a better semver match (!).This PR updates the version numbers to be aligned with what is published on NPM. I extracted the version list from the GitHub action run log, there are 112 published packages.
The changelogs are still not up to date. For example,
packages/components/CHANGELOG.mdmentions as "unreleased" also changes that were published in 31.0.0. But that's much harder to fix because the changelog already contains a lot of newer entries. It will be fixed only after the next release.