Release Process and Versioning
Relevant source files
The following files were used as context for generating this wiki page:- scripts/release/README.md
- scripts/release/utils.js
- scripts/rollup/build-all-release-channels.js
- scripts/release/publish-commands/print-follow-up-instructions.js
- scripts/release/prepare-release-from-ci.js
- scripts/release/build-release.js
- scripts/devtools/README.md
- scripts/devtools/prepare-release.js
- packages/react-devtools-extensions/build.js
- README.md
The React release process is a structured system designed to manage the publication of different types of releases, from automated daily prereleases to manual stable releases. The process relies on a combination of CI/CD automation via GitHub Actions and a suite of command-line scripts located in scripts/release. This system ensures that experimental features can be tested by collaborators without affecting production users, while stable releases undergo a more rigorous promotion process.
The core of the process revolves around different release channels (next, experimental, latest), each serving a distinct purpose. Most prereleases are published automatically by a CI cron job, but manual intervention is possible and required for stable releases. The versioning scheme for prereleases is directly tied to the Git commit hash and date, ensuring traceability from a build artifact back to its source code.
Sources: scripts/release/README.md:3-13
Release Channels
React utilizes multiple NPM distribution tags (channels) to manage releases.
next: This channel is for prereleases built from the tip of themainbranch. These are published frequently (typically each weekday via an automated cron job) and are intended for early testing of upcoming features. They are created from CI artifacts.experimental: Similar tonext, this channel also contains prereleases frommain, but with additional experimental features enabled. This allows for testing of highly unstable or un-finalized APIs.latest: This is the stable release channel. Releases on this channel are considered production-ready. A stable release is always created by "promoting" a release from thenextchannel, never directly from a commit. This ensures that the exact artifacts have been tested in the wild before being marked as stable.
The --tags argument in the publish.js script controls which channel a release is published to. For example, --tags next publishes to the next channel, while --tags latest next would update both the latest and next tags to point to the new version.
Sources: scripts/release/README.md:5-7, 21-25, 60-63, 72-75, 81-84
Versioning Scheme
The versioning scheme differs between prereleases (canaries) and stable releases.
Prerelease (Canary) Versioning
Prereleases on the next and experimental channels use a version format that embeds build metadata directly into the version string. This makes each prerelease version unique and traceable.
The format is 0.0.0-<commit>-<date> for next channel releases and 0.0.0-experimental-<commit>-<date> for experimental ones.
<commit>: The short Git commit hash (e.g.,0e526bc).<date>: The date of the commit inYYYYMMDDformat.
A separate reactVersion is also generated, which is based on the version from packages/react/package.json and includes the same suffix (e.g., 18.3.0-alpha-0e526bc-20230510). This version is embedded into renderer builds via packages/shared/ReactVersion.js and is used by React DevTools to distinguish between React versions.
This version information is generated in the getBuildInfo function.
// scripts/release/utils.js:65-74
const getBuildInfo = async () => {
// ...
const commit = await execRead('git show -s --no-show-signature --format=%h', {
cwd,
});
const dateString = await getDateStringForCommit(commit);
const version = isExperimental
? `0.0.0-experimental-${commit}-${dateString}`
: `0.0.0-${commit}-${dateString}`;
// ...
};
Sources: scripts/release/utils.js:65-86, 203-206, scripts/rollup/build-all-release-channels.js:18-23
Stable Versioning
When a next release is promoted to stable, the release engineer is prompted to enter a semantic version number (e.g., 18.3.0). The prepare-release-from-npm.js script then updates all package.json files and the embedded ReactVersion.js with this new stable version number.
Sources: scripts/release/README.md:87-91
Release Workflows
The release process is divided into several distinct workflows, most of which are handled by the scripts in scripts/release.
Automated Prerelease Workflow
This is the most common path for publishing next and experimental releases.
This diagram shows the automated process where commits to main are built and tested, with successful artifacts being published daily or on-demand to prerelease channels.
Sources: scripts/release/README.md:19-25, 38-51
Promoting "Next" to "Stable"
This is a manual process performed by a release engineer to create a new stable release.
This sequence illustrates the steps for promoting a pre-tested next build to a latest stable release, including version bumping, publishing, and Git tagging.
Sources: scripts/release/README.md:85-101, scripts/release/publish-commands/print-follow-up-instructions.js:46-77
Creating a Patch Release
Patch releases are created from a branch off a previous release tag, not from main.
This flow shows that patch releases are carefully constructed by selecting specific fixes, which are then run through the standard prerelease and promotion pipeline.
Sources: scripts/release/README.md:108-124
Release Scripts
A set of Node.js scripts in the scripts/release directory automates the release tasks.
| Script | Description |
|---|---|
prepare-release-from-ci.js | Downloads build artifacts from a specific commit in CI. Used to prepare a next or experimental release. |
prepare-release-from-npm.js | Downloads a next release from NPM and prepares it to be promoted to stable by updating version numbers. |
publish.js | Publishes the contents of the build/node_modules directory to NPM. Takes --tags to specify the channel and a --dry flag to simulate a run. |
build-release-locally.js | An "escape hatch" script to create a release build from the local Git revision. It does not run automated tests and is meant for special cases. |
Sources: scripts/release/README.md:131-188
DevTools Release Process
The React DevTools extension has its own, separate release process documented in scripts/devtools/README.md.
The process is a sequence of three scripts:
prepare-release.js: Increments version numbers inpackage.jsonand manifest files, updates the changelog with recent commits, and commits these changes.build-and-test.js: (Implicitly mentioned) Builds the extension and runs tests against it.publish-release.js: Publishes the DevTools packages to NPM.
After the NPM publish, the release engineer must manually upload the extension bundles to the Chrome, Edge, and Firefox stores.
Sources: scripts/devtools/README.md:3-21, scripts/devtools/prepare-release.js:68-81, scripts/devtools/publish-release.js:33-35, 42-50