Linux command
semantic-release 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Run semantic-release
npx semantic-release
Run with a specific version
npx semantic-release@[25]
Perform a dry run
npx semantic-release --dry-run
Run with additional plugins
npx --package semantic-release --package @semantic-release/exec semantic-release
Run with specific branches
npx semantic-release --branches [main]
Run ignoring CI
npx semantic-release --no-ci
Specify the repository URL
npx semantic-release --repository-url [https://github.com/user/repo.git]
说明
semantic-release automates the entire package release workflow including version determination, changelog generation, and package publishing. It analyzes commits since the last release using conventional commit messages to determine the next semantic version number automatically. The tool follows the Semantic Versioning specification: fix commits trigger patch releases, feat commits trigger minor releases, and commits with BREAKING CHANGE trigger major releases. It integrates with npm, GitHub, GitLab, and other platforms through a plugin system. Configuration can be provided via package.json, .releaserc file, release.config.js, or CLI arguments. By default, it releases from main or master branches, with support for pre-release channels (alpha, beta) and maintenance branches.
参数
- -d, --dry-run
- Run in dry-run mode to preview the pending release without actually publishing. Skips prepare, publish, addChannel, success, and fail steps. Prints the next version and release notes to console.
- --ci, --no-ci
- Toggle CI environment verification. Use --no-ci to run semantic-release in a local environment outside of CI. Useful for testing and debugging.
- -b, --branches
- Define the branches on which releases should happen. Accepts branch names or micromatch glob patterns.
- -p, --plugins
- Define the list of plugins to use.
- -r, --repository-url
- The git repository URL.
- -t, --tag-format
- The Git tag format used to identify releases. Default: v${version}.
- -e, --extends
- Shareable configuration to extend.
- --debug
- Enable debug output.
- -h, --help
- Display help information.
FAQ
What is the semantic-release command used for?
semantic-release automates the entire package release workflow including version determination, changelog generation, and package publishing. It analyzes commits since the last release using conventional commit messages to determine the next semantic version number automatically. The tool follows the Semantic Versioning specification: fix commits trigger patch releases, feat commits trigger minor releases, and commits with BREAKING CHANGE trigger major releases. It integrates with npm, GitHub, GitLab, and other platforms through a plugin system. Configuration can be provided via package.json, .releaserc file, release.config.js, or CLI arguments. By default, it releases from main or master branches, with support for pre-release channels (alpha, beta) and maintenance branches.
How do I run a basic semantic-release example?
Run `npx semantic-release` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -d, --dry-run do in semantic-release?
Run in dry-run mode to preview the pending release without actually publishing. Skips prepare, publish, addChannel, success, and fail steps. Prints the next version and release notes to console.