LibraryActive

semantic-release Plugin Development

Guide for creating plugins for semantic-release, covering lifecycle methods, context, and best practices.

Open source page

Field note

What it does

This page is a developer guide for creating plugins for semantic-release, a tool that automates versioning and releases. It explains how to set up a plugin project, expose lifecycle methods such as verifyConditions, analyzeCommits, and publish, support custom options, and understand the context object provided to each lifecycle. It also covers error handling, execution order, and advanced topics like multiple analyzeCommits plugins.

Capabilities

Available capabilities

No use cases filed yet.

Tags

Tags

Ways to use it

Ways to use it

No integrations filed yet.

Product features

Product features

Context Keys

Context object contains keys like cwd, env, envCi, commit, branch, branches, commits, nextRelease, releases, errors, etc.

Error Handling

Lifecycles success and fail are mutually exclusive; fail receives errors.

Lifecycle Methods

Plugins can implement lifecycle methods such as verifyConditions, analyzeCommits, verifyRelease, generateNotes, addChannel, prepare, publish, success, and fail.

Option Validation

Plugins can validate user-provided options in the pluginConfig object.

Plugin Config and Context

Each lifecycle method receives pluginConfig and context objects, providing access to user options and environment information.

Project Setup

Recommended to use yarn init, create index.js, src/lib folder, test folder, and set up ESLint.