feat(release): one v-tag per release, carrying the GitHub release notes - #49
Merged
Merged
Conversation
`changeset publish` tags every package separately (`datocms-plugin-sdk@2.2.7`, `datocms-react-ui@2.2.7`), which is the right default when packages move independently. Ours don't: they're a `fixed` group, so the two tags always point at the same commit and say the same thing — and the `vX.Y.Z` tag this repo used for its first 222 tags stopped being created. Publish now runs with `--no-git-tag` and the script tags `vX.Y.Z` itself, *after* the publish returns. That keeps the invariant that made this rewrite worth doing — a tag can only exist for a version that is actually on the registry — and makes it slightly stronger: a partial publish now leaves no tag at all, rather than one tag per package that made it. The tag then carries the release notes. Only 6 of the 222 tags ever had a GitHub release, because writing one meant composing it by hand; changesets has already written that prose into the `CHANGELOG.md`s, so the script reads each package's section for this version and posts them under one release. A prerelease is marked as such, so a `next` publish can't take over the repository's "Latest release" badge. `gh` is checked in preflight, alongside npm auth, so a missing GitHub CLI stops the release before anything is mutated rather than after npm has been published.
The link is read back with `gh release view` instead of being parsed out of `gh release create`, so it's the same whether the release was just created or was already there from an interrupted run — and a lookup that fails leaves the success message intact rather than killing the script at the very last line.
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.
Follow-up to #48, now that the first release on the new tooling (v2.2.7) has
shown what it looks like in practice.
What changed
changeset publishtags every package separately —datocms-plugin-sdk@2.2.7,datocms-react-ui@2.2.7. That's the right default for independent versioning,but our two packages are a
fixedgroup: the tags always point at the samecommit and carry the same information, and the
vX.Y.Ztag this repo used forits first 222 tags stopped being created.
So
changeset publishnow runs with--no-git-tag, and the script createsvX.Y.Zitself, right after the publish returns.This doesn't weaken the ordering invariant from #48, it tightens it: a tag can
still only exist for a version that is actually on the registry, and now a
partial publish leaves no tag at all, instead of one tag for each package
that made it through.
GitHub releases
Only 6 of 222 tags ever got a release, and the one recent one (
v2.2.1) wascomposed by hand. But changesets now writes exactly that prose into the
CHANGELOG.mds, so the script reads each package's section for the versionbeing released and posts them as one release, one heading per package:
(That's the real output of the new
release_noteshelper against the v2.2.7changelogs.) It's generated, not curated — if a release deserves a write-up like
v2.2.1got, edit it afterwards.A prerelease is marked
--prerelease, so apublish-nextcan't take over therepository's "Latest release" badge.
Preflight
ghand its auth are checked up front, next tonpm whoami. A missing GitHubCLI now stops the release before anything is mutated, rather than after npm has
already been published to.
How this was verified
No release was cut to test this, so here's what was actually checked:
--no-git-tagsuppresses every tag, not just some. Read from the installedsource:
@changesets/cli/dist/publish.mjs:94guards thetag-onlypath and:188guards the successful-publish path, both with the sameoptions?.gitTag ?? true. With the flag off,gitTagReleasesstays empty andcreateGitTagsreceives nothing.--tag. cac turns--no-git-tagintogitTag: false; verified by replaying the CLI's own option declaration(
--git-tag, defaulttrue) through cac with--no-git-tag --tag next.release_noteswas run against the actualv2.2.7 changelogs — that's the output quoted above.
gh release create --notes-file -reads stdin (gh release create --help).master.Not verified: the
gh release createcall itself has never run. The firstrelease on this script will be the first time it executes.