---
myst:
  html_meta:
    "description": "Change the steps of repoplone release: drop or reorder built-in steps, and add a step of your own with local_step."
    "property=og:description": "Change the steps of repoplone release: drop or reorder built-in steps, and add a step of your own with local_step."
    "property=og:title": "Customize the release"
    "keywords": "Plone, repoplone, release, steps, local_step, hook, pipeline"
---

(how-to-customize-the-release)=

# 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.

(how-to-customize-the-release-list)=

## See the current steps

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

```shell
uvx repoplone settings release-steps
```

(how-to-customize-the-release-drop)=

## Drop a step

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

```toml
[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.

(how-to-customize-the-release-add)=

## Add a step of your own

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

```python
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.

```toml
[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.

(how-to-customize-the-release-check)=

## Check the configuration

Validate the file and import every step of your own.

```shell
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.

```shell
uvx repoplone release --dry-run minor
```

```{seealso}
- {ref}`reference-release-steps-local`, for the arguments a step receives.
- {ref}`reference-settings-file-release`, for every key of `[repository.release]`.
```
