nx release: per-group changelog files not staged into release commit when using --groups with fixed projectsRelationship
Current Behavior
When running the top-level nx release command with --groups=… (no --projects= flag) on a config that uses fixed release groups with a per-group changelog.file, the generated changelog files are written to disk but not staged into the release commit. Only the package.json updates from the version phase end up in the release commit; the CHANGELOG.md files for each affected group remain dirty in the working tree and are discarded when CI tears down.
The log shows two related symptoms:
Per-project iteration inside fixed groups. For a fixed group with N projects sharing one
changelog.file, the log emits NGenerating an entry in <file> for <group>@v<version>lines. The first iteration writes; subsequent iterations logNOTE: There was no diff detected for the changelog entry.Final summary incorrectly reports no changes. After several files have been
UPDATEd /CREATEd in the per-group iteration, the run still prints:NX No changes detected for changelogs No changes were detected for any changelog files, so no changelog entries will be generated.The release commit then contains only the version-phase
package.jsonwrites; the changelog files never make it into the index.
Expected Behavior
When nx release writes one or more per-group changelog/<group>/CHANGELOG.md files during the changelog phase, those files should be staged into the same release commit as the package.json version bumps.
Steps to Reproduce
Initialize an Nx workspace with two libraries that match a wildcard, e.g.
domain-feature-aandproviders-feature-a.Configure a fixed release group sharing a per-group changelog file. Minimal
nx.json:{ "release": { "git": { "commitMessage": "chore: updated version [no ci]" }, "version": { "conventionalCommits": true }, "changelog": { "workspaceChangelog": false, "projectChangelogs": true }, "groups": { "feature-a": { "projects": ["*-feature-a"], "projectsRelationship": "fixed", "releaseTag": { "pattern": "feature-a@v{version}" }, "changelog": { "file": "changelog/feature-a/CHANGELOG.md", "createRelease": "github" }, "version": { "conventionalCommits": true } } } } }Tag a starting version:
git tag [email protected].Add a conventional commit that affects one of the projects in the group:
fix(feature-a): trigger a patch bumpRun the top-level release command (no
--projects=):nx release --groups=feature-a --skip-publishInspect the resulting release commit:
git show HEAD --stat
Observed:
- The console log shows
UPDATE changelog/feature-a/CHANGELOG.mdonce (with the new entry diff), then a secondGenerating an entry in changelog/feature-a/CHANGELOG.md for [email protected]followed byNOTE: There was no diff detected for the changelog entry. - The final summary prints
[NX] No changes detected for changelogs / No changelog entries will be generated. git show HEAD --statlists only the twopackage.jsonfiles.changelog/feature-a/CHANGELOG.mdis dirty in the working tree but not in the commit.
Nx Report
(output of `nx report` from the affected workspace)
Node : 20.x
OS : linux x64
Native Target : x86_64-linux
nx : 22.5.2
@nx/js : 22.5.2
@nx/workspace : 22.5.2Failure Logs
NX Staging changed files with git # version phase only — package.json files
NX Generating an entry in changelog/feature-a/CHANGELOG.md for [email protected]
UPDATE changelog/feature-a/CHANGELOG.md
+ ## 1.0.1 (...)
+
+ ### Fixes
+
+ - **feature-a:** trigger a patch bump
NX Generating an entry in changelog/feature-a/CHANGELOG.md for [email protected]
NOTE: There was no diff detected for the changelog entry. Maybe you intended to pass alternative git references via --from and --to?
NX No changes detected for changelogs
No changes were detected for any changelog files, so no changelog entries will be generated.
NX Committing changes with git
NX Tagging commit with git
NX Pushing to git remote "origin"Resulting commit:
$ git show HEAD --stat
chore: updated version [no ci]
packages/domain-feature-a/package.json | 2 +-
packages/providers-feature-a/package.json | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)Package Manager Version
bun 1.3.10 (also reproduced with npm; not package-manager-specific.)
Operating System
- macOS
- Linux
- Windows
- Other
Additional Information
Related prior reports:
- #33268 —
@nx/release: duplicated projects (manifests when using--projects=). - #34851 — adds a
new Set(...)dedupe, but only inside theargs.projects?.lengthcode branch inpackages/nx/src/command-line/release/changelog.ts. The--groups=(default) branch does not pass through that dedupe, which is consistent with the duplicate per-project iteration we still observe on 22.5.2 and onmaster.
Source: nrwl/nx