> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/nrwl/nx/llms.txt
> Use this file to discover all available pages before exploring further.

# nx release

> Orchestrate versioning, changelog generation, and publishing of packages in the workspace.

`nx release` is a set of subcommands for managing the full release lifecycle: bumping versions, generating changelogs, and publishing to a registry.

```bash theme={null}
nx release [specifier] [options]      # full release workflow
nx release version [specifier]        # version only
nx release changelog <version>        # changelog only
nx release publish                    # publish only
nx release plan [bump]                # create a version plan
nx release plan:check                 # verify version plans exist
```

## Subcommands

<AccordionGroup>
  <Accordion title="nx release (full workflow)">
    Runs version bumping, changelog generation, and optionally publishing in a single command.

    ```bash theme={null}
    nx release
    nx release minor
    nx release --dry-run
    nx release --first-release
    ```

    **Positional argument**

    <ParamField path="specifier" type="string">
      Exact version or semver keyword to apply (e.g., `major`, `minor`, `patch`, `prerelease`, or `1.2.3`).
    </ParamField>

    **Options**

    <ParamField query="--preid" type="string">
      Prerelease identifier to append when using `prerelease` as the specifier, or when using conventional commits (e.g., `alpha`, `beta`).
    </ParamField>

    <ParamField query="--yes" type="boolean">
      Automatically answer yes to the publish confirmation prompt. Alias: `-y`. Mutually exclusive with `--skip-publish`.
    </ParamField>

    <ParamField query="--skip-publish" type="boolean">
      Skip publishing by automatically answering no to the publish confirmation. Mutually exclusive with `--yes`.
    </ParamField>

    <ParamField query="--otp" type="number">
      One-time password for publishing to a registry that requires 2FA.
    </ParamField>

    <ParamField query="--first-release" type="boolean">
      Indicates this is the first release for the selected release group. Uses the version on disk as a fallback when the current version cannot be determined, and skips checking for existing tags or packages.
    </ParamField>
  </Accordion>

  <Accordion title="nx release version">
    Bump the version of one or more projects without running changelog or publish steps.

    ```bash theme={null}
    nx release version minor
    nx release version 2.0.0
    nx release version --dry-run
    ```

    **Positional argument**

    <ParamField path="specifier" type="string">
      Exact version or semver keyword (e.g., `major`, `minor`, `patch`, `1.2.3`).
    </ParamField>

    **Options**

    <ParamField query="--preid" type="string">
      Prerelease identifier (e.g., `alpha`, `beta`).
    </ParamField>

    <ParamField query="--stage-changes" type="boolean">
      Stage the changes made by this command. Useful when combining with changelog generation.
    </ParamField>

    <ParamField query="--git-commit" type="boolean">
      Automatically commit the changes made by this command.
    </ParamField>

    <ParamField query="--git-commit-message" type="string">
      Custom commit message. Use `{version}` as a placeholder for the version.
    </ParamField>

    <ParamField query="--git-commit-args" type="string">
      Additional arguments to pass to `git commit`.
    </ParamField>

    <ParamField query="--git-tag" type="boolean">
      Automatically create a git tag after versioning.
    </ParamField>

    <ParamField query="--git-tag-message" type="string">
      Custom message for the git tag.
    </ParamField>

    <ParamField query="--git-push" type="boolean">
      Automatically push commits and tags to the remote repository.
    </ParamField>

    <ParamField query="--git-remote" type="string" default="origin">
      The git remote to push to.
    </ParamField>

    <ParamField query="--first-release" type="boolean">
      Indicates this is the first release for the selected release group.
    </ParamField>
  </Accordion>

  <Accordion title="nx release changelog">
    Generate a changelog for one or more projects and optionally create a GitHub/GitLab release.

    ```bash theme={null}
    nx release changelog 2.0.0
    nx release changelog 2.0.0 --from=v1.0.0
    nx release changelog 2.0.0 --interactive=all
    ```

    **Positional argument**

    <ParamField path="version" type="string" required>
      The version to generate the changelog for.
    </ParamField>

    **Options**

    <ParamField query="--from" type="string">
      Git ref to use as the start of the changelog range. Defaults to the latest matching tag.
    </ParamField>

    <ParamField query="--to" type="string" default="HEAD">
      Git ref to use as the end of the changelog range.
    </ParamField>

    <ParamField query="--interactive" type="string">
      Open changelogs in your editor before applying. Choices: `all`, `workspace`, `projects`. Alias: `-i`.
    </ParamField>

    <ParamField query="--replace-existing-contents" type="boolean" default="false">
      Overwrite the existing changelog file contents instead of prepending to them.
    </ParamField>

    <ParamField query="--resolve-version-plans" type="string" default="all">
      How to resolve version plan files for changelog generation. Choices: `all`, `using-from-and-to`.
    </ParamField>

    <ParamField query="--first-release" type="boolean">
      Indicates this is the first release; skips checking for existing git tags.
    </ParamField>
  </Accordion>

  <Accordion title="nx release publish">
    Publish versioned projects to a package registry.

    ```bash theme={null}
    nx release publish
    nx release publish --registry=https://registry.npmjs.org
    nx release publish --tag=next
    nx release publish --dry-run
    ```

    **Options**

    <ParamField query="--registry" type="string">
      The registry URL to publish to.
    </ParamField>

    <ParamField query="--tag" type="string">
      The distribution tag to apply to the published package (e.g., `latest`, `next`, `beta`).
    </ParamField>

    <ParamField query="--access" type="string">
      Access level for the published package. Choices: `public`, `restricted`. Unscoped packages cannot be set to `restricted`.
    </ParamField>

    <ParamField query="--otp" type="number">
      One-time password for registries that require 2FA.
    </ParamField>

    <ParamField query="--first-release" type="boolean">
      Skip checking for the existence of the package before publishing.
    </ParamField>
  </Accordion>

  <Accordion title="nx release plan">
    Create a version plan file specifying the desired semver bump and a changelog entry for one or more projects or groups.

    ```bash theme={null}
    nx release plan minor
    nx release plan patch --message="Fix memory leak in cache layer"
    ```

    **Positional argument**

    <ParamField path="bump" type="string">
      Semver keyword. Choices: `major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, `prerelease`.
    </ParamField>

    **Options**

    <ParamField query="--message" type="string">
      Custom message to use as the changelog entry. Alias: `-m`.
    </ParamField>

    <ParamField query="--only-touched" type="boolean" default="true">
      Only include projects affected by current changes.
    </ParamField>
  </Accordion>

  <Accordion title="nx release plan:check">
    Verify that all touched projects have an applicable version plan file. Exits with a non-zero code if any are missing.

    ```bash theme={null}
    nx release plan:check
    nx release plan:check --base=origin/main
    ```
  </Accordion>
</AccordionGroup>

## Global release options

These options apply to all `nx release` subcommands.

<ParamField query="--dry-run" type="boolean" default="false">
  Preview changes without updating files, creating releases, or publishing packages. Alias: `-d`.
</ParamField>

<ParamField query="--verbose" type="boolean">
  Print additional information about the release process.
</ParamField>

<ParamField query="--groups" type="string">
  One or more release groups to target (comma-separated). Defined in `nx.json`. Aliases: `--group`, `-g`. Mutually exclusive with `--projects`.
</ParamField>

<ParamField query="--projects" type="string">
  Comma or space-separated project names or patterns to target. Alias: `-p`. Mutually exclusive with `--groups`.
</ParamField>

<ParamField query="--print-config" type="string">
  Print the resolved `nx release` configuration for the current command and exit.
</ParamField>

## Examples

<CodeGroup>
  ```bash Full release workflow (dry run first) theme={null}
  nx release --dry-run
  nx release
  ```

  ```bash First release of a new package theme={null}
  nx release --first-release
  ```

  ```bash Bump version only (no publish) theme={null}
  nx release version minor
  ```

  ```bash Generate changelog for a specific version theme={null}
  nx release changelog 2.1.0 --from=v2.0.0
  ```

  ```bash Publish to a custom registry with a dist-tag theme={null}
  nx release publish --registry=https://my.registry.com --tag=next
  ```

  ```bash Target a specific release group theme={null}
  nx release --groups=backend-libs
  ```

  ```bash Target specific projects theme={null}
  nx release version patch --projects=mylib,otherlib
  ```
</CodeGroup>

## Release groups

Release groups let you version and publish different subsets of your workspace independently. Define groups in `nx.json`:

```json theme={null}
{
  "release": {
    "groups": {
      "frontend": {
        "projects": ["myapp", "ui-lib"]
      },
      "backend": {
        "projects": ["api", "data-access"]
      }
    }
  }
}
```

Then target a group with:

```bash theme={null}
nx release version minor --groups=frontend
```
