Skip to content

feat(release)!: refactor releaseTag* properties to a releaseTag object#33020

Merged
Coly010 merged 2 commits intomasterfrom
release/refactor-release-tag-pattern
Oct 10, 2025
Merged

feat(release)!: refactor releaseTag* properties to a releaseTag object#33020
Coly010 merged 2 commits intomasterfrom
release/refactor-release-tag-pattern

Conversation

@Coly010
Copy link
Copy Markdown
Contributor

@Coly010 Coly010 commented Oct 8, 2025

Current Behavior

The Nx release configuration currently uses 5 separate flat properties for release tag
configuration:

  • releaseTagPattern
  • releaseTagPatternCheckAllBranchesWhen
  • releaseTagPatternRequireSemver
  • releaseTagPatternPreferDockerVersion
  • releaseTagPatternStrictPreid

This flat structure makes the configuration verbose and harder to organize, especially
as more release tag options are added.

Example of current configuration:

{
  "release": {
    "releaseTagPattern": "{projectName}@{version}",
    "releaseTagPatternRequireSemver": true,
    "releaseTagPatternStrictPreid": false
  }
}

Expected Behavior

After this PR, all release tag-related configuration is consolidated into a single
nested releaseTag object with the following structure:

  • releaseTag.pattern (was releaseTagPattern)
  • releaseTag.checkAllBranchesWhen (was releaseTagPatternCheckAllBranchesWhen)
  • releaseTag.requireSemver (was releaseTagPatternRequireSemver)
  • releaseTag.preferDockerVersion (was releaseTagPatternPreferDockerVersion)
  • releaseTag.strictPreid (was releaseTagPatternStrictPreid)

Example of new configuration:

  {
    "release": {
      "releaseTag": {
        "pattern": "{projectName}@{version}",
        "requireSemver": true,
        "strictPreid": false
      }
    }
  }

Migration & Backward Compatibility:

  • An automatic migration transforms old configurations to the new structure
  • Old flat properties are deprecated but still supported during the migration period
  • The deprecated properties will be removed in Nx 23
  • All internal code has been updated to use the new nested structure

BREAKING CHANGE: This is a breaking change in the preferred configuration structure. Existing configurations will continue to work through the migration period, but users should update to the new nested format.

@Coly010 Coly010 requested a review from FrozenPandaz as a code owner October 8, 2025 14:52
@Coly010 Coly010 self-assigned this Oct 8, 2025
@Coly010 Coly010 requested review from a team, AgentEnder and jaysoo as code owners October 8, 2025 14:52
@vercel
Copy link
Copy Markdown

vercel bot commented Oct 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
nx-dev Ready Ready Preview Oct 10, 2025 0:07am

@netlify
Copy link
Copy Markdown

netlify bot commented Oct 8, 2025

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit e04ea45
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/68e8f44fca08eb00081815f0
😎 Deploy Preview https://deploy-preview-33020--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Coly010 Coly010 force-pushed the release/refactor-release-tag-pattern branch from 7a409fa to 2f45383 Compare October 8, 2025 15:36
@Coly010 Coly010 force-pushed the release/refactor-release-tag-pattern branch from 2f45383 to e5ae7b4 Compare October 8, 2025 17:01
@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud bot commented Oct 8, 2025

View your CI Pipeline Execution ↗ for commit e04ea45

Command Status Duration Result
nx affected --targets=lint,test,test-kt,build,e... ✅ Succeeded 38m 16s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 2m 22s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 3s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 5s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗
nx documentation ✅ Succeeded 50s View ↗

☁️ Nx Cloud last updated this comment at 2025-10-10 12:40:55 UTC

nx-cloud[bot]

This comment was marked as outdated.

nx-cloud[bot]

This comment was marked as outdated.

nx-cloud[bot]

This comment was marked as outdated.

Consolidate 5 separate releaseTag* properties into a single nested releaseTag object:
- releaseTagPattern → releaseTag.pattern
- releaseTagPatternCheckAllBranchesWhen → releaseTag.checkAllBranchesWhen
- releaseTagPatternRequireSemver → releaseTag.requireSemver
- releaseTagPatternPreferDockerVersion → releaseTag.preferDockerVersion
- releaseTagPatternStrictPreid → releaseTag.strictPreid

Updated NxReleaseConfiguration interface and NxReleaseConfig type to support the new structure.
Old properties are deprecated but still supported for backward compatibility.

BREAKING CHANGE: This changes the preferred configuration structure for release tags.
The old flat structure is deprecated and will be removed in Nx 23.

feat(nx): update config handling to use nested releaseTag structure

Updated default value processing and group configuration in config.ts:
- Modified WORKSPACE_DEFAULTS and GROUP_DEFAULTS to use releaseTag object
- Added backward compatibility by checking both new and deprecated properties
- Updated docker project inference logic to use releaseTag.requireSemver and releaseTag.preferDockerVersion
- All configuration merging now handles both old flat and new nested formats

Changes maintain full backward compatibility - old flat structure still works during migration period.

feat(nx): update consumers to use nested releaseTag structure

- Update git.ts: Rename GetLatestGitTagForPatternOptions properties to use simplified names (requireSemver, strictPreid)
- Update shared.ts: Change all releaseGroup.releaseTagPattern references to releaseGroup.releaseTag.pattern and releaseTagPatternPreferDockerVersion to releaseTag.preferDockerVersion
- Update changelog.ts: Update all getLatestGitTagForPattern calls to use new nested structure and update error messages
- Update release-group-processor.ts: Change releaseGroup property access to use nested releaseTag structure

- Add new releaseTag nested object property with pattern, checkAllBranchesWhen, requireSemver, preferDockerVersion, and strictPreid sub-properties
- Mark old flat properties (releaseTagPattern, releaseTagPatternCheckAllBranchesWhen, etc.) as deprecated with x-deprecated annotations
- Apply changes to both root release configuration and release groups configuration
- Maintain backward compatibility by keeping deprecated properties in schema

feat(nx): add migration to consolidate releaseTag* config

- Create migration that transforms old flat releaseTag* properties to new nested releaseTag object structure
- Handle migrations for nx.json (root and groups), project.json, and package.json
- Preserve new format when both old and new properties exist (new takes precedence)
- Include comprehensive test coverage for migration scenarios
- Register migration in migrations.json as "22-0-0-consolidate-release-tag-config"

test(nx): update test fixtures to use nested releaseTag structure

- Update shared.spec.ts: Convert all releaseTagPattern* properties to nested releaseTag object
- Update git.spec.ts: Change releaseTagPatternRequireSemver/StrictPreid to requireSemver/strictPreid
- Update config.spec.ts: Update all snapshot expectations to use nested structure
- Update filter-release-groups.spec.ts: Update mock release group fixtures
- Update version-plan-utils.spec.ts: Update mock release group setup

All test fixtures now match the new nested releaseTag configuration format.

fix(release): remove deprecated releaseTagPattern properties from group type

Add RemoveDeprecatedPropertiesFromEach type utility to ensure deprecated
properties are removed from group types in NxReleaseConfig. This prevents
type errors when the deprecated flat properties are no longer present in
the runtime objects after the configuration normalization.

fix(release): remove deprecated releaseTagPattern properties from group type

Add RemoveDeprecatedPropertiesFromEach type utility to ensure deprecated
properties are removed from group types in NxReleaseConfig. This prevents
type errors when the deprecated flat properties are no longer present in
the runtime objects after the configuration normalization.
Copy link
Copy Markdown
Contributor

@nx-cloud nx-cloud bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nx Cloud is proposing a fix for your failed CI:

We've identified and fixed a missed test update. The PR updated error messages to reference the new nested configuration path "release.releaseTag.pattern", and while two tests were updated accordingly, one test on line 318 was missed. This change updates that test to match the new error message format, which will resolve the TypeError.

We verified this fix by re-running e2e-release:e2e-ci--src/first-release.test.ts.

diff --git a/e2e/release/src/first-release.test.ts b/e2e/release/src/first-release.test.ts
index 0f1823ca5c..0da1412576 100644
--- a/e2e/release/src/first-release.test.ts
+++ b/e2e/release/src/first-release.test.ts
@@ -315,7 +315,7 @@ describe('nx release first run', () => {
       expect(
         releaseOutput3.match(
           new RegExp(
-            `NX   Unable to determine the previous git tag. If this is the first release of your workspace, use the --first-release option or set the "release.changelog.automaticFromRef" config property in nx.json to generate a changelog from the first commit. Otherwise, be sure to configure the "release.releaseTagPattern" property in nx.json to match the structure of your repository's git tags.`,
+            `NX   Unable to determine the previous git tag. If this is the first release of your workspace, use the --first-release option or set the "release.changelog.automaticFromRef" config property in nx.json to generate a changelog from the first commit. Otherwise, be sure to configure the "release.releaseTag.pattern" property in nx.json to match the structure of your repository's git tags.`,
             'g'
           )
         ).length

✅ The fix was applied to this branch.

View interactive diff ↗


🎓 To learn more about Self Healing CI, please visit nx.dev

@Coly010 Coly010 merged commit 0ba5f2d into master Oct 10, 2025
19 checks passed
@Coly010 Coly010 deleted the release/refactor-release-tag-pattern branch October 10, 2025 13:11
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants