Plugins

Each release step is implemented by configurable plugins. This allows for support of different commit message formats, release note generators and publishing platforms.

A plugin is a npm module that can implement one or more of the following steps:

Note: If no plugin with a analyzeCommits step is defined @semantic-release/commit-analyzer will be used.

Plugins installation

Default plugins

These four plugins are already part of semantic-release and are listed in order of execution. They do not have to be installed separately:

"@semantic-release/commit-analyzer"
"@semantic-release/release-notes-generator"
"@semantic-release/npm"
"@semantic-release/github"

Additional plugins

Additional plugins have to be installed via npm:

$ npm install @semantic-release/git @semantic-release/changelog -D

Plugins declaration and execution order

Each plugin must be configured with the plugins options by specifying the list of plugins by npm module name.

{
  "plugins": ["@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", "@semantic-release/npm"]
}

Note: If the plugins option is defined, it overrides the default plugin list, rather than merging with it.

For each release step the plugins that implement that step will be executed in the order in which they are defined.

{
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    "@semantic-release/npm",
    "@semantic-release/git"
  ]
}

With this configuration semantic-release will:

  • execute the verifyConditions implementation of @semantic-release/npm then @semantic-release/git

  • execute the analyzeCommits implementation of @semantic-release/commit-analyzer

  • execute the generateNotes implementation of @semantic-release/release-notes-generator

  • execute the prepare implementation of @semantic-release/npm then @semantic-release/git

  • execute the publish implementation of @semantic-release/npm

Plugin options configuration

A plugin configuration can be specified by wrapping the name and an options object in an array. Options configured this way will be passed only to that specific plugin.

Global plugin configuration can be defined at the root of the semantic-release configuration object. Options configured this way will be passed to all plugins.

{
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    ["@semantic-release/github", {
      "assets": ["dist/**"]
      }],
    "@semantic-release/git"
  ],
  "preset": "angular"
}

With this configuration:

  • All plugins will receive the preset option, which will be used by both @semantic-release/commit-analyzer and @semantic-release/release-notes-generator (and ignored by @semantic-release/github and @semantic-release/git)

  • The @semantic-release/github plugin will receive the assets options (@semantic-release/git will not receive it and therefore will use it's default value for that option)

Last updated