Update release flow to be more robust#3938
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Overhauls the npm release automation to support additional release channels (beta/rc), optional explicit version publishing, and stronger validation around what can be published and tagged.
Changes:
- Add release helpers for computing next stable/pre-release versions and validating latest vs non-latest publishes.
- Refactor release scripting by extracting argument parsing and version computation into dedicated modules.
- Add Jest-based unit tests for the release scripts and introduce a CI workflow to run them.
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Adds Jest dependency to lockfile for running new script tests. |
| package.json | Adds test script and Jest dev dependency for running release-script tests. |
| scripts/release/version-utils.js | Adds helpers to compute latest/next stable/pre-release versions using npm registry queries. |
| scripts/release/validate-non-latest-version.js | Adds validation to prevent publishing non-latest releases when the base version already exists. |
| scripts/release/validate-latest-version.js | Adds validation to ensure latest-tagged stable releases increment semver correctly. |
| scripts/release/should-be-latest.js | Expands logic for deciding whether a stable release should be tagged as latest. |
| scripts/release/set-package-version.js | Refactors to use shared argument parsing + version selection helpers. |
| scripts/release/parse-arguments.js | Introduces centralized CLI flag parsing for release scripts. |
| scripts/release/get-version.js | Implements version selection logic per release type (stable/beta/rc/commitly). |
| scripts/release/tests/version-utils.test.js | Adds unit tests for version parsing and next-version helpers. |
| scripts/release/tests/validate-non-latest-version.test.js | Adds unit tests for non-latest publish validation logic. |
| scripts/release/tests/validate-latest-version.test.js | Adds unit tests for latest publish validation logic. |
| scripts/release/tests/should-be-latest.test.js | Adds unit tests for npm-tag selection logic. |
| scripts/release/tests/parse-arguments.test.js | Adds unit tests for release CLI argument parsing. |
| scripts/release/tests/get-version.test.js | Adds unit tests for deriving versions for each release type. |
| .github/workflows/run-jest-tests.yml | Adds a CI workflow to run the new Jest tests. |
| .github/workflows/publish-release.yml | Extends publish workflow to support manual stable/beta/rc and automatic commitly releases. |
| .github/actions/publish-npm-package/action.yml | Updates composite action to accept release type/version, determine npm tag, and validate versions before publishing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
m-bert
reviewed
Feb 3, 2026
m-bert
approved these changes
Feb 4, 2026
j-piasecki
added a commit
that referenced
this pull request
Feb 5, 2026
## Description Overhaul of the release process: - adds `beta` and `rc` options to the previously existing `stable` and `commitly` - allows the release of a specific version, independent from the branch name (optional, will still detect the version from the branch name when unspecified) - verifies that the latest version is either one patch, one minor, or one major higher than the currently published version (ATM throws on major change) - verifies that beta, rc and commitly releases aren't done for an already published version (i.e. will disallow publishing `2.30.0-beta.1` when stable `2.30.0` is published`). - automatic numbering of beta and rc releases Internally: - moved most of the helpers to separate files - moved version numbering helpers to `version-utils` - added tests covering the release scripts ## Test plan Tested on a fork: - Fails when trying to skip minor on latest release: https://github.com/j-piasecki/react-native-gesture-handler/actions/runs/21475940199/job/61859862583 - Fails when trying to skip patch on latest release: https://github.com/j-piasecki/react-native-gesture-handler/actions/runs/21476045075/job/61860214823 - Fails when trying to publish on existing versions (checks base version for beta, rc, and commitly): https://github.com/j-piasecki/react-native-gesture-handler/actions/runs/21476741044/job/61862557674 - Succeeds when not skipping any minor: https://github.com/j-piasecki/react-native-gesture-handler/actions/runs/21476056662/job/61860252565 - Succeeds when not skipping any patch: https://github.com/j-piasecki/react-native-gesture-handler/actions/runs/21476183083/job/61860683061 - Succeeds when publishing a non-latest release: https://github.com/j-piasecki/react-native-gesture-handler/actions/runs/21476510871/job/61861782101
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.
Description
Overhaul of the release process:
betaandrcoptions to the previously existingstableandcommitly2.30.0-beta.1when stable2.30.0is published`).Internally:
version-utilsTest plan
Tested on a fork: