Once you have leveraged Nx's powerful code generation and task running capabilities to build your libraries and applications, you will want to share them with your users.
Nx provides a set of tools to help you manage your releases called nx release.
We recommend always starting with --dry-run, because publishing is difficult to undo
nx release --dry-runWhat makes up a release?
Section titled “What makes up a release?”A release can be thought about in three main phases:
- Versioning - The process of determining the next version of your projects, and updating any projects that depend on them to use the new version.
- Changelog - The process of deriving a changelog from your commit messages or version plan files, which can be used to communicate the changes to your users.
- Publishing - The process of publishing your projects to a registry, such as npm for TypeScript/JavaScript libraries, crates.io for Rust, or Docker registries for container images.
Running Releases
Section titled “Running Releases”The nx release command is used to run the release process from end to end. It is a wrapper around the three main phases of a release to provide maximum convenience and ease of use.
By default, when you run nx release it will prompt you for a version keyword (e.g. major, minor, patch) or a custom version number. The release command will then run the three phases of the release process in order: versioning, changelog generation, and publishing.
When trying it out for the first time, you need to pass the --first-release flag since there is no previous release to compare against for changelog purposes. It is strongly recommended to use the --dry-run flag to see what will be published in the first release without actually pushing anything to the registry.
nx release --first-release --dry-runSet Up Your Workspace
Section titled “Set Up Your Workspace”Follow our guides to set up Nx Release for your workspace.
Basic Configuration
Section titled “Basic Configuration”Configure Nx Release in your nx.json file:
{ "release": { "projects": ["packages/*"] }}The nx release command is customizable. You can customize the versioning, changelog, and publishing phases of the release process independently through a mixture of configuration and CLI arguments.
See the configuration reference for all available options.
Using the Programmatic API for Nx Release
Section titled “Using the Programmatic API for Nx Release”A powerful feature of Nx Release is the fact that it is designed to be used via a Node.js programmatic API in addition to the nx release CLI.
Releases are a hugely complex and nuanced process, filled with many special cases and idiosyncratic preferences, and it is impossible for a CLI to be able to support all of them out of the box. By having a first-class programmatic API, you can go beyond the CLI and create custom release workflows that are highly dynamic and tailored to your specific needs.
See our dedicated guide on the programmatic API to learn more and see some example release scripts.
Learn More
Section titled “Learn More”Configuration & Customization
Section titled “Configuration & Customization”- Version Projects Independently - Version projects independently or together
- Release Groups - Organize projects into release groups with specific configuration for each group
- Conventional Commits - Automate versioning based on commit messages
- Custom Registries - Publish to private or alternative registries
- CI/CD Integration - Automate releases in your pipeline
- Changelog Customization - Control changelog generation and formatting
- Custom Commit Types - Define custom conventional commit types
- Version Prefixes - Configure version prefix patterns
Workflows
Section titled “Workflows”- Automate with GitHub Actions - Set up automated releases in GitHub workflows
- Release Projects Independently - Manage independent versioning for projects
- Use Conventional Commits - Enable automatic versioning from commits
- Build Before Versioning - Run builds before version updates
References
Section titled “References”- Configuration in
nx.json- All available options for configuringnx release