---
myst:
  html_meta:
    "description": "Release a Plone project repository with repoplone: preview the changelog, rehearse with a dry run, release, and restart a release that failed."
    "property=og:description": "Release a Plone project repository with repoplone: preview the changelog, rehearse with a dry run, release, and restart a release that failed."
    "property=og:title": "Release a repository"
    "keywords": "Plone, repoplone, release, dry run, version, changelog, start-step"
---

(how-to-release)=

# Release a repository

This guide shows you how to release a repository with `repoplone release`.
It assumes the repository has a `repository.toml` file and news fragments to release.

(how-to-release-prepare)=

## Prepare the working tree

Switch to the branch you release from, and update it.

```shell
git switch main
git pull --ff-only
```

Check that the working tree is clean.

```shell
git status --short
```

The release commit includes every tracked file with changes.
repoplone refuses to start a release while a tracked file has uncommitted changes.
Commit or stash them first.

(how-to-release-preview)=

## Preview the changelog and the version

Print the changelog entry the release will write.

```shell
uvx repoplone changelog preview
```

Print the next version for each bump keyword.

```shell
uvx repoplone versions next
```

Pick the keyword that gives the version you want, such as `minor` or `a`.

(how-to-release-dry-run)=

## Rehearse with a dry run

Run the release with `--dry-run` and the keyword.

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

repoplone runs every step, and prints what it would change.
It does not commit, tag, push, or publish.
It does build each Python package with `publish = true`, and leaves a `dist/` folder in it.
The release empties that folder before it builds again.

(how-to-release-run)=

## Release

Run the same command without `--dry-run`.

```shell
uvx repoplone release minor
```

repoplone prints the changelog entry and asks you to continue.
It then shows the new version and asks again.
It then releases the packages, pushes the commit and the tag, and creates the GitHub release, without asking.
The last step prints a summary and asks for a final confirmation, after everything is done.

In a calver repository, leave out the keyword.
repoplone computes the next version.

```shell
uvx repoplone release
```

In a semver repository, leaving out the keyword shows a menu of versions to choose from.

(how-to-release-restart)=

## Restart a release that failed

When a step fails, repoplone prints `Release failed:`, the step, and the reason.
Fix the cause, then restart from the step that failed.

```shell
uvx repoplone release --start-step release_python 1.2.0
```

Give the version of the release that failed.
After the `version` step, repoplone does not compute it again.
Packages already published at that version are skipped.

To list the step ids of the repository, run this command.

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

```{seealso}
- {doc}`authenticate`, to set up PyPI, npm, and GitHub before the first release.
- {doc}`/explanation/release-pipeline`, for why a release runs as steps.
- {doc}`/reference/release-steps`, for what each step writes.
```
