Skip to content

Plugin Based Releases #321

Open
Open
@esatterwhite

Description

@esatterwhite

Description

The reference javascript implementation, is almost entirely plugin driven leaving the core library to be effectively a general harness that manages the execution of a plugin list and configuration passing.

Use cases

It would be nice to define a release process as a set of plugins, this also paves the way for shareable configurations and community driven functionality not directly supported by this project.

It would off load a good amount of complexity from the core library and allow people external to the project to implement new functionality and override existing behavior

Possible implementation

[tool.semantic-release]
extends = 'release-config-special'
plugins = [
  ['<plugin-name>', {
    option1 = true,
    option2 = 'a-value'
    option3 = 100
  }]
]

A plugin name is a reference to a python module.

#  plugin-name/__init__.py

def verify_conditions(*agrs, **kwargs):
  pass

def analyze_commits(*args, **kwargs):
  pass

def verify_release(*args, **kwargs):
  pass

def generate_notes(*args, **kwargs):
  pass

def prepare(*args, **kwargs):
  pass

def publish(*args, **kwargs):
  pass

def add_channel(*args, **kwargs):
  pass

def success(*args, **kwargs):
  pass

def fail(*args, **kwargs):
  pass

A plugin could also be a class or even a simple callbale, however, I think the expectation of a module that exports
simple toplevel functions the easiest and most flexible thing

[tool.semantic-release]
extends = 'release-config-special'
plugins = [
  ['<plugin-name>', {
    option1 = true,
    option2 = 'a-value'
    option3 = 100
  }]
]
# plugin-name/__init__.py
from semantic_release import Plugin
__PLUGIN_NAME__ = 'PluginName'


class PluginName(Plugin):

  def __init__(*args, **kwargs):
    super().__init__(*args, **kwargs)

  def verify_conditions(*agrs, **kwargs):
    pass

  def analyze_commits(*args, **kwargs):
    pass

  def verify_release(*args, **kwargs):
    pass

  def generateNotes(*args, **kwargs):
    pass

  def prepare(*args, **kwargs):
    pass

  def publish(*args, **kwargs):
    pass

  def add_channel(*args, **kwargs):
    pass

  def success(*args, **kwargs):
    pass

  def fail(*args, **kwargs):
    pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureA new feature or a feature requesthelp-wantedExtra attention is required

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions