Repository navigation
ci: publish to npm automatically from CI - #1225
Conversation
The android job fails intermittently — roughly half of recent runs — while
Jetifier rewrites react-android-0.81.1-debug.aar:
Failed to transform react-android-0.81.1-debug.aar
> Execution failed for JetifyTransform: .../react-android-0.81.1-debug.aar
> Java heap space
The failure happens during dependency resolution, before any project code is
compiled, and is unrelated to whatever change is under test. 2g is no longer
enough for the transform; ubuntu runners have ample memory.
This matters beyond the flake itself: publishing is gated on a green Build, so
an intermittently red android job intermittently blocks releases.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GWYKHSVSNoLM8Hquum8CuD
Releases were a manual, local operation: a maintainer ran `yarn release` with npm credentials on hand. Every published release is authored by one person, and master has carried four releasable commits since v2.0.0 without them reaching npm. Add a Release workflow that runs the existing release-it configuration in CI. It triggers on the Build workflow completing on master and releases only if Build passed, so publishing is gated on lint, tsc, and the Android/iOS builds. Version and changelog still come from @release-it/conventional-changelog, so output matches the current manual release. Two guards keep it honest: - If master has moved past the commit Build validated, the run skips rather than publishing code CI never checked. The next green Build picks it up. - The `chore: release` commit release-it pushes is ignored, so a release cannot trigger another release. A run whose commits are all chore/docs/test/refactor stops before touching npm, since the angular preset would produce no version bump. Authentication uses an NPM_TOKEN repository secret, read via the .npmrc that actions/setup-node writes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GWYKHSVSNoLM8Hquum8CuD
9115752 to
cd75550
Compare
CONTRIBUTING.md documented `!` after the type as producing a major
release, but the configured `angular` preset does not parse `!` at all.
Its header pattern is /^(\w*)(?:\((.*)\))?: (.*)$/ with no
breakingHeaderPattern, and whatBump only escalates to major when a
commit has notes, which only a `BREAKING CHANGE:` footer produces.
Checked against the installed presets:
angular conventionalcommits
PATCH (type=undef) MAJOR feat!: drop iOS 13 support
PATCH (type=undef) MAJOR refactor!: remove MenuView.foo
PATCH MAJOR refactor: tidy + BREAKING-CHANGE: footer
MAJOR MAJOR feat: x + BREAKING CHANGE: footer
So a maintainer following the docs to remove a public API would have
shipped it as a patch. Note `feat!:` does not even register as a
feature under angular, so it was a patch rather than a minor.
Switch the preset to `conventionalcommits`, which supports `!` on any
type and accepts both the spaced and hyphenated footer. It is already a
direct dependency of @release-it/conventional-changelog alongside the
angular preset, so this needs no dependency change.
Also in the release guard:
- Widen the releasable-commit test to match the preset: `!` on any type
counts, not just feat/fix/perf, so a `refactor!:` breaking change no
longer skips the release entirely.
- Check the subject and the body against separate patterns. Matching one
pattern against the whole message let a body line that merely starts
with "fix: " count as a fix, which a `docs:` commit with a prose body
could trigger.
- Read commits from a file rather than a pipe, so a failing `git log`
fails the step instead of silently counting zero and skipping.
- Require `workflow_run.event == 'push'`. The `branches: master` filter
matches the triggering run's head branch, and Build also runs on
pull_request, so a fork PR from a branch named "master" satisfied it.
The head_sha guard already stopped that from publishing, but this
states the intent rather than relying on the backstop.
- Bump checkout and setup-node to v5, matching the Build workflow.
Verified the guard against a synthetic history covering 16 message
shapes, and against real history since v2.0.0: it finds the same 4
releasable commits that conventional-recommended-bump does, which
recommends `minor` from feat(ios): preferredElementSize.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ReviewRebased onto master (which now carries #1234) and pushed fixes for the findings below. All five checks were green on the rebased head before the fix commit. 1. The documented versioning rule was wrong — fixed in 5e79cf6
But Run against the two installed presets:
So a maintainer following the docs to remove a public API would have shipped it as a patch. Note Switched the preset to 2. Guard fixes — also in 5e79cf6
Verified against a synthetic history covering 16 message shapes (all pass), and against real history since v2.0.0: the guard finds the same 4 releasable commits that 3. Still needed before merge:
|
Overview
Implements #1223. Releases move from a manual local operation to a CI workflow.
Today a release means a maintainer running
yarn releasewith npm credentials on hand. Every published release is authored by one person, andmastercurrently carries four releasable commits sincev2.0.0that have never reached npm —feat(ios): preferredElementSize(#1202) plus threefix:commits.The release tooling itself was already configured; only the automation was missing. This PR does not change how versions or changelogs are produced.
.github/workflows/release.ymlTriggers on the
Buildworkflow completing onmasterand runs the existingrelease-itconfiguration if Build passed. Usingworkflow_runmeans the gate is exact — lint, tsc, android, and both iOS builds must be green before anything is published — and it builds on the push trigger fixed in #1224.Version and release notes still come from
@release-it/conventional-changelog, so the output matches the current manual release. The bump is decided entirely by commit messages:fix:/perf:→ patch,feat:→ minor,!or aBREAKING CHANGE:footer → major.Two guards:
masterhas moved past the commit Build validated, the run skips instead of shipping code CI never checked. The next green Build picks it up.chore: release <version>commit that release-it pushes is ignored.A push whose commits are all
chore/docs/test/refactorstops before touching npm, since the angular preset would produce no bump.Authentication uses an
NPM_TOKENrepository secret, read through the.npmrcthatactions/setup-nodewrites.GITHUB_TOKENwithcontents: writecovers the release commit, tag, and GitHub release.Releasecan also be dispatched manually for a release that failed partway through. That path skips the Build gate by design and is documented as such.Gradle heap bump
Separate commit, and a prerequisite rather than an unrelated drive-by. The
androidjob fails intermittently — roughly half of recent runs — during dependency resolution:It failed on #1222's first attempt and on the
masterpush run after #1224 merged, and passed on #1222's re-run and on #1224. Since publishing is gated on a green Build, a job that fails half the time blocks releases half the time.-Xmx2gis no longer enough for the Jetifier transform; ubuntu runners have ample memory.Before the first release
An npm access token with publish rights on
@react-native-menu/menumust be added as anNPM_TOKENrepository secret. Without it the workflow runs and fails at the publish step.Two things worth checking:
master. Ifmasterrequires pull requests or status checks for pushes,GITHUB_TOKENwill be rejected and the release will fail after publishing to npm, leaving npm and git out of sync.featmislabelled aschoresilently ships nothing.CONTRIBUTING.mdstates that pre-commit hooks verify the format, but no husky, lefthook, or commitlint configuration exists in the repo — so squash-merge titles are what actually decide the version. This is documented rather than enforced; wiring up commitlint would be a separate change.Test Plan
A
workflow_runtrigger only fires from the workflow file on the default branch, so this workflow cannot execute before merge. The first merge tomasteris the real test. What was verified instead:masterit resolvesgit describe --tags --abbrev=0tov2.0.0, walksv2.0.0..HEAD, and finds exactly 4 releasable commits — the 1featand 3fixlisted above — which is a minor bump. Re-running it after a release would find 0 and skip.conventional-changelog's own header parser, so the guard and release-it agree on what counts as releasable. (Note this means a historical subject likefix:lint errorwould be skipped by both, consistently.)release.ymlwas parsed as YAML to confirm it is well formed.31983633654(themasterpush run) and cross-checked against the same failure on docs: add CLAUDE.md with build commands and architecture overview #1222, confirming it happens in:app:checkDebugAarMetadataduring dependency transform, before any project code compiles.yarn lintcould not be run — dependencies are not installed in this environment. Biome 1.9.4 covers JS/TS/JSON, and this diff is YAML, Markdown, and a.propertiesfile, so it is outside Biome's scope regardless. Thelintjob on this PR confirms it.The
androidjob on this PR is the first check of the heap bump; if it passes here and on subsequent runs, the OOM is addressed.Generated by Claude Code