Repository navigation
ci(release): create the GitHub release from the CHANGELOG section - #48
Open
jameslcowan wants to merge 2 commits into
Open
jameslcowan wants to merge 2 commits into
jameslcowan wants to merge 2 commits into
Conversation
Problem: release.yml published to npm and left the GitHub release to a manual step that CONTRIBUTING.md described. The step was skipped 9 times: the newest GitHub release was 0.4.1 while npm had 0.11.0, and a visitor to the repository saw a project 7 releases behind its package. Change: a github-release job runs after the publish job and creates the release for the tag, or edits it on a re-run. Its notes are the version's CHANGELOG.md section, which scripts/release-notes.mjs reads from the heading `## YYYY-MM-DD X.Y.Z: summary` to the next heading, with the wrapped lines of each paragraph joined. The publish job checks that the section exists before it publishes anything. Permissions: the workflow default is contents: read; the publish job keeps id-token: write; only the new job gets contents: write. cli/test/release-notes.test.js covers the reader and fails when cli/package.json names a version with no section. CONTRIBUTING.md states the heading format. Intent: every published version has a GitHub release with real notes, with no manual step to forget. Assisted-by: Claude
# Conflicts: # .github/workflows/release.yml # CHANGELOG.md
Collaborator
Author
|
Left open for the maintainer. CI is green on all 7 jobs (the |
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.
What changed
release.ymlpublished to npm and left the GitHub release to a manual step inCONTRIBUTING.md. The step was skipped 9 times: until today the newest GitHub release was 0.4.1 while npm had 0.11.0. A visitor to the repository saw a project 7 published versions behind its package.The 9 missing releases now exist, made by hand from the same CHANGELOG sections this workflow will read (v0.5.0 to v0.11.0, v0.11.0 marked latest). This pull request makes the next ones automatic.
github-releasejob runs afterpublishsucceeds. It creates the release for the tag, or edits it on a re-run, with the titlecomplex-md X.Y.Z.CHANGELOG.mdsection.scripts/release-notes.mjsreads it from## YYYY-MM-DD X.Y.Z: summaryto the next##heading and joins the wrapped lines of each paragraph, because a release page shows every line break.publishjob checks that the section exists beforenpm ci, so a release with no notes stops before anything is published.contents: read.publishkeepsid-token: writewith read access. Onlygithub-releasegetscontents: write. All actions stay pinned to commit SHAs (checkout 7.0.1, setup-node 7.1.0, as in the other workflows).CONTRIBUTING.mdstates the heading format and that the workflow creates the release.What it does not do: a tag whose version has no
X.Y.Z:heading fails the release before publish. 2 old versions, 0.5.0 and 0.7.0, had sections with no version in the heading; their releases were made by hand.How it was tested
cli/test/release-notes.test.js: the reader on a fixture (a section ends at the next heading,0.9.1never takes the0.9.10section, CRLF reads the same, a leadingvis accepted), and the realCHANGELOG.mdhas a section for the version incli/package.json.node scripts/release-notes.mjsproduced the notes of the 7 versioned releases created today;99.0.0exits 1 with the expected heading in the message.cd cli && npm test: exit 0, 844 pass, 0 fail, 2 todo.publish: {contents: read, id-token: write}andgithub-release: {contents: write}.gh release createcall itself. The first real run is the next release; if it fails, the npm publish has already succeeded and a re-run of thegithub-releasejob alone is safe.AI assistance
Assisted-by:or aCo-Authored-By:trailer.ownerlabel).🤖 Generated with Claude Code
https://claude.ai/code/session_011jHASLngEodgNzogro3gQz