Description
Current Behavior
I discovered that when using nx release
in a project configured to use conventionalCommits: true
(so git-tag
as source for current version) and projectsRelationship: "independent"
, the tag filtering breaks, resulting in nx release
(no --preid
) using the wrong previous version (tag).
Based on the implementation, the tags are sorted using the versionsort.suffix=-
option so that a version 0.1.2
appears before 0.1.2-bla.0
, which works. But in a standard workflow, one will first release a 0.1.3-prerelease.0
before a 0.1.3
(stable).
Currently, if the latest pre-release version is 0.1.3-prerelease.0
and stable is 0.1.2
, nx release
will use the pre-release version to calculate the new stable, and likely find no changes.
As a result, running nx release
with no --preid
option when there are existent pre-release tags will not result in the creation of a stable release.
Expected Behavior
nx release
tag sorting logic should be mixed with a filtering of pre-release only tags for a latest version, to correctly release a stable version from a pre-release.
When the following tags are present:
my-project@0.0.1
my-project@0.0.1-beta.0
my-project@0.0.2
my-project@0.0.3-beta.0
The selected tag used by nx release
(no --preid
) should be my-project@0.0.2
, not my-project@0.0.3-beta.0
, so that conventional-commits uses the latest stable as source commit.
GitHub Repo
No response
Steps to Reproduce
- Set up independent releases
- Create initial release with
nx release
-> createspackage@0.0.1
- Release package with
nx release --preid=test
-> createspackage@0.0.2-test.0
- Run
nx release
- Acknowledge that no release is created, because the prerelease tag is used instead of the latest, previous, stable release
Nx Report
Node : 22.16.0
OS : darwin-arm64
Native Target : aarch64-macos
npm : 10.9.2
nx (global) : 21.1.1
nx : 21.2.0
@nx/js : 21.2.0
@nx/jest : 21.2.0
@nx/eslint : 21.2.0
@nx/workspace : 21.2.0
@nx/devkit : 21.2.0
@nx/esbuild : 21.2.0
@nx/eslint-plugin : 21.2.0
@nx/module-federation : 21.2.0
@nx/node : 21.2.0
@nx/plugin : 21.2.0
@nx/react : 21.2.0
@nx/vite : 21.2.0
@nx/web : 21.2.0
typescript : 5.8.3
---------------------------------------
Registered Plugins:
@nx/js/typescript
@nx/react/router-plugin
@nx/eslint/plugin
@nx/vite/plugin
---------------------------------------
Cache Usage: 57.91 MB / 46.04 GB
Failure Logs
Package Manager Version
No response
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
No response