Repository navigation
Conversation
Replace the local publish.sh flow with the changesets release workflow. Merging a change does not publish. It updates a release pull request, and merging that publishes @readme/cli from the commit that introduced the version. Co-authored-by: Jon Ursenbach <erunion@users.noreply.github.com>
Contributor
Confidence Score: 5/5
[High impact] The PR appears safe to merge with the repository settings described by the author. Reviews (1) · Last reviewed commit: "build(release): publish stable releases ..." · Reviewed by Greptile |
Match the release flow now on rdme main. The tags job runs when the version tag, floating major tag, or GitHub release is still missing, even if npm already has the version. It stays on the workflow commit and tags the commit that introduced the version. Release jobs use Node 24. Co-authored-by: Jon Ursenbach <erunion@users.noreply.github.com>
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
Stable releases of
@readme/climove frompublish.shto the changesets flow thatrdmepublishes frommain, including the tag-repair behavior now onrdmemain.Merging a feature pull request does not publish a new version. A change ships when someone merges the pull request titled
build(release): vX.Y.Z. Every push tomainchecks whether npm already has the version inpackage.json. If it does not, that version is published from the first-parent commit that introduced it. A later merge that still carries that version is not the release commit, and an empty changeset does not skip the unpublished version.select-modeis not part of that decision: an empty changeset makes it returnnone, and GitHub can cancel the waiting run of the version merge when a newer push arrives. A prerelease is skipped instead of failing the job.publish.sh. There are no prereleases..github/workflows/release.ymlis the trusted-publisher workflow. The publish job is the only job withid-token: write. It does not setNPM_TOKEN,NODE_AUTH_TOKEN, orregistry-url, and it does not use a GitHub Environment. Release jobs use Node 24. That release ships npm 11.5.1 or newer, which trusted publishing requires.changesets/action/version@v2when a changeset requests a release. Itsgithub-tokeninput andGITHUB_TOKENenvironment variable are bothRELEASE_GH_TOKEN.@changesets/changelog-githubreadsGITHUB_TOKENwhilechangeset versionwrites the changelog. The combinedchangesets/actionthrows if those two values differ.release:versionrunsnpm install --package-lock-only --ignore-scriptsafterchangeset version, thennpm run build:gha. Changesets updatespackage.jsonand leavespackage-lock.jsonon the previous version. The GitHub Action bundle is committed, so the release pull request rebuilds it.mainpublishes a stable version, including 0.x, on thelatestdist-tag. This repo has no maintenance branch, so there is nov9/release-v9path.bin/set-release-pr-title.jsrenames the pull request tobuild(release): vX.Y.Zfrom the version just written. A later bump renames it again. The job then adds thereleaselabel.finishseparately from whether this run calls npm.finishstays true while the version tag, the unprefixed tag, the floating major tag, or the GitHub release is missing, including when npm already has the version. The plan step setsGH_TOKENsogh release viewcan see a release that already exists. Without that token, a finished release looks missing and the tags job runs on every push.vX.Y.Z, the unprefixed tag, and the floating major tag (v0while the package is 0.x,v1from 1.0.0), then opens the GitHub release. The publish action does not taggithub.sha, because that can be a later commit.package.jsonfileslistsbin/readme.js,bin/build-gha.js, andbin/git-format.jsinstead of the wholebindirectory, so the release scripts are not in the npm tarball.CHANGELOG.mdis included.mainwith changesets." The version pull request moves0.5.0to0.5.1. Changelog headings stay## 0.5.0. A heading like## [0.5.0](...)is ignored, and the next entry would be written further down the file.After this merges
Do these in order. They are repository settings, not part of this change.
releaselabel. The version job applies it and fails if the label is missing.RELEASE_GH_TOKENsecret that can open pull requests, push commits, and push tags.@readme/cli, bound to.github/workflows/release.ymlonmain.0.5.1.0.5.1shows_npmUser.nameofGitHub Actionsanddist.attestations, delete anyNPM_TOKENsecret and set publishing access to require two-factor authentication and disallow tokens.Test plan
npm test(lint, oxfmt, schemas check, 346 tests)npx vitest run test/bin(44 tests), including a missing tag, a missing GitHub release, a floating major tag on an older version, a floating major tag already on a newer version, an unreadable remote version, a finished release, a skipped prerelease, and readingpackage.jsonfrom the release commit after HEAD has moved onnpm view @readme/cli@0.5.1was published by GitHub Actions with attestations