Configuration
Last updated
Last updated
semantic-release configuration consists of:
Git repository ( and options and )
Plugins and options
Run mode (, and )
All of these options can be configured through config file, CLI arguments or by extending a .
Additionally, metadata of Git tags generated by semantic-release can be customized via standard .
semantic-release’s , mode and can be set via either:
A .releaserc
file, written in YAML or JSON, with optional extensions: .yaml
/.yml
/.json
/.js
/.cjs
/.mjs
A release.config.(js|cjs|.mjs)
file that exports an object
A release
key in the project's package.json
file
Alternatively, some options can be set via CLI arguments.
The following three examples are the same. Use main instead of master if your default branch is main.
Via release
key in the project's package.json
file:
Via .releaserc
file:
Via release.config.cjs
file:
Via release.config.mjs
file:
Via CLI argument:
Note: CLI arguments take precedence over options configured in the configuration file.
Note: Plugin options cannot be defined via CLI arguments and must be defined in the configuration file.
Note: When configuring via package.json
, the configuration must be under the release
property. However, when using a .releaserc
or a release.config
file, the configuration must be set without a release
property.
Type: Array
, String
CLI arguments: -e
, --extends
Note: Options defined via CLI arguments or in the configuration file will take precedence over the ones defined in any shareable configuration.
Type: Array
, String
, Object
Default: ['+([0-9])?(.{+([0-9]),x}).x', 'master', 'main', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]
CLI arguments: --branches
The branches on which releases should happen. By default semantic-release will release:
regular releases to the default distribution channel from the branch master
or main
regular releases to a distribution channel matching the branch name from any existing branch with a name matching a maintenance release range (N.N.x
or N.x.x
or N.x
with N
being a number)
regular releases to the next
distribution channel from the branch next
if it exists
regular releases to the next-major
distribution channel from the branch next-major
if it exists
pre-releases to the beta
distribution channel from the branch beta
if it exists
pre-releases to the alpha
distribution channel from the branch alpha
if it exists
Note: If your repository does not have a release branch, then semantic-release will fail with an ERELEASEBRANCHES
error message. If you are using the default configuration, you can fix this error by pushing a master
or main
branch.
The git repository URL.
Type: String
Default: v${version}
CLI arguments: -t
, --tag-format
Type: Array
Default: ['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']
CLI arguments: -p
, --plugins
Plugins configuration can defined by wrapping the name and an options object in an array.
Type: Boolean
Default: false
if running in a CI environment, true
otherwise
CLI arguments: -d
, --dry-run
The objective of the dry-run mode is to get a preview of the pending release. Dry-run mode skips the following steps: prepare, publish, addChannel, success and fail. In addition to this it prints the next version and release notes to the console.
Note: The Dry-run mode verifies the repository push permission, even though nothing will be pushed. The verification is done to help user to figure out potential configuration issues.
Type: Boolean
Default: true
CLI arguments: --ci
/ --no-ci
Set to false
to skip Continuous Integration environment verifications. This allows for making releases from a local machine.
Note: The CLI arguments --no-ci
is equivalent to --ci false
.
Type: Boolean
Default: false
CLI argument: --debug
Output debugging information. This can also be enabled by setting the DEBUG
environment variable to semantic-release:*
.
GIT_AUTHOR_NAME
@semantic-release-bot.
GIT_AUTHOR_EMAIL
@semantic-release-bot email address.
GIT_COMMITTER_NAME
@semantic-release-bot.
GIT_COMMITTER_EMAIL
@semantic-release-bot email address.
For example, if your release branch is master
/main
, the last release published on your project is 1.1.0
and the last commit included has the sha 1234567
, you must make sure this commit is in master
/main
history and is tagged with v1.1.0
.
List of modules or file paths containing a . If multiple shareable configurations are set, they will be imported in the order defined with each configuration option taking precedence over the options defined in a previous shareable configuration.
Note: Branches configuration key accepts globs.
Note: Once semantic-release is configured, any user with the permission to push commits on one of those branches will be able to publish a release. It is recommended to protect those branches, for example with .
See for more details.
Type: String
Default: repository
property in package.json
or
CLI arguments: -r
, --repository-url
Any valid git url format is supported (See ).
The format used by semantic-release to identify releases. The tag name is generated with and will be compiled with the version
variable.
Note: The tagFormat
must contain the version
variable exactly once and compile to a .
Define the list of plugins to use. Plugins will run in series, in the order defined, for each if they implement it.
See for more details.
Note: The debug
is used only supported via CLI argument. To enable debug mode from the use require('debug').enable('semantic-release:*')
.
The author name associated with the . See .
The author email associated with the . See .
The committer name associated with the . See .
The committer email associated with the . See .
semantic-release uses to determine the commits added since the last release. If a release has been published before setting up semantic-release you must make sure the most recent commit included in the last published release is in the history and is tagged with the version released, formatted according to the configured (defaults to vx.y.z
).
If the previous releases were published with this should already be the case.