Customize the release#

This guide shows you how to change the steps that repoplone release runs. You can drop steps, reorder them, and add steps of your own.

See the current steps#

List the steps of the repository, in the order they run.

uvx repoplone settings release-steps

Drop a step#

Add a [repository.release] table to repository.toml, and list the steps to keep. This list skips the GitHub release.

[repository.release]
steps = ["changelog", "version", "repository", "release_python", "release_node", "git", "bye"]

A repository without Node packages never runs release_node. You can leave it in the list.

Add a step of your own#

Write the step as a Python function in the repository, for instance in scripts/release.py.

def notify(step_id, title, settings, state, **kwargs):
    if state.dry_run:
        print(f"Would announce {state.next_version} in {kwargs['channel']}")
        return True
    print(f"Announcing {state.next_version} in {kwargs['channel']}")
    return True

The function must return a true value. A false value fails the release.

Register the function, and add its id to the list of steps.

[repository.release]
steps = ["changelog", "version", "repository", "release_python", "release_node", "git", "notify", "gh_release", "bye"]

[repository.release.registry.notify]
function = "local_step"
title = "Announce the release"
args = { entrypoint = "scripts.release:notify", channel = "releases" }

entrypoint names the module and the function, relative to the root of the repository. The other keys of args reach the function as keyword arguments.

Check the configuration#

Validate the file and import every step of your own.

uvx repoplone settings sanity-check

The command prints Settings OK and the number of steps. It reports each entrypoint it cannot import, and exits with code 1.

Then rehearse the release.

uvx repoplone release --dry-run minor

See also