---
myst:
  html_meta:
    "description": "A first release with repoplone: describe a small package in repository.toml, add a news fragment, rehearse with a dry run, and release it locally."
    "property=og:description": "A first release with repoplone: describe a small package in repository.toml, add a news fragment, rehearse with a dry run, and release it locally."
    "property=og:title": "Your first release"
    "keywords": "Plone, repoplone, tutorial, release, repository.toml, towncrier, news fragment"
---

(tutorial-first-release)=

# Your first release

In this tutorial, we will release a small Python package with repoplone.
We will describe it in `repository.toml`, write a news fragment, rehearse the release, and run it.

The repository lives only on your computer.
It has no remote and its package is not published.
Nothing leaves your computer.

You need [uv](https://docs.astral.sh/uv/) and git.

(tutorial-first-release-create)=

## Create the repository

Create a folder with a git repository, and the folders the package needs.

```shell
mkdir hello-plone
cd hello-plone
git init -b main
mkdir -p src/hello_plone news
```

Create `src/hello_plone/__init__.py` with the version of the package.

```python
__version__ = "1.0.0"
```

Create `version.txt` with the version of the repository.

```text
1.0.0
```

Create `pyproject.toml`.
It tells hatch where the version is, and tells towncrier where the news fragments and the changelog are.

```toml
[project]
name = "hello-plone"
dynamic = ["version"]
description = "A package to try repoplone."
requires-python = ">=3.12"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.version]
path = "src/hello_plone/__init__.py"

[tool.towncrier]
directory = "news/"
filename = "CHANGELOG.md"
start_string = "<!-- towncrier release notes start -->\n"
title_format = "## {version} ({project_date})"
underlines = ["", "", ""]
```

Create `CHANGELOG.md`.
towncrier writes each release below the marker line.

```markdown
# Changelog

<!-- towncrier release notes start -->
```

(tutorial-first-release-describe)=

## Describe the repository

Create `repository.toml`.

```toml
spec_version = "2"

[repository]
name = "hello-plone"
changelog = "CHANGELOG.md"
version = "version.txt"

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

[[package]]
type = "python"
name = "hello-plone"
path = "."
changelog = "CHANGELOG.md"
towncrier.settings = "pyproject.toml"
publish = false
```

The `[repository]` table names the repository, its changelog, and its version file.
The `[[package]]` table declares one Python package at the root of the repository.
`publish = false` keeps it off PyPI.

The `[repository.release]` table lists the release steps.
It leaves out `gh_release`, because this repository is not on GitHub.

Commit the files.

```shell
git add .
git commit -m "Start hello-plone"
```

Ask repoplone for the versions.

```shell
uvx repoplone@2.0.0a2 versions current
```

```console
           Current versions
┏━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓
┃ Section    ┃ Name        ┃ Version ┃
┡━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩
│ Repository │ hello-plone │ 1.0.0   │
│ python     │ hello-plone │ 1.0.0   │
└────────────┴─────────────┴─────────┘
```

Notice that repoplone reads two versions.
The repository version comes from `version.txt`.
The package version comes from the package itself, through hatch.

(tutorial-first-release-news)=

## Write a news fragment

A news fragment is a small file that describes one change.
Its name is the issue number and the type of change.

Create `news/1.feature`.

```text
Say hello to Plone.
```

See the changelog entry the release will write.

```shell
uvx repoplone@2.0.0a2 changelog preview
```

```console
==================================================
## 1.0.0 (2026-12-03)

### hello-plone

#### Features

- Say hello to Plone. (#1)

==================================================
```

The preview uses the current version, because the next one is not chosen yet.

(tutorial-first-release-version)=

## Choose the version

See where each bump keyword leads.

```shell
uvx repoplone@2.0.0a2 versions next
```

The table lists `minor` with `1.1.0`.
A new feature calls for a minor release.

(tutorial-first-release-dry-run)=

## Rehearse the release

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

```shell
uvx repoplone@2.0.0a2 release --dry-run minor
```

repoplone first warns that it has no GitHub token.
The release has no GitHub step.
Answer `y`.

It then runs each step, and asks you to confirm the changelog entry and the version.
Answer `y` to each question.

```console
02/06 Next version
   - Bump version from 1.0.0 to 1.1.0
   Continue? [y/n] (y): y
03/06 Update repository components
   - Would update CHANGELOG.md file
   - Would update version.txt file

04/06 Release Python packages
   - Released hello-plone: 1.1.0

05/06 Commit changes, create tag
   - Skipped creating tag 1.1.0
```

Check the working tree.

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

It prints nothing.
The dry run changed no file.

(tutorial-first-release-release)=

## Release

Run the same command without `--dry-run`, and answer `y` to each question.

```shell
uvx repoplone@2.0.0a2 release minor
```

This time, the steps write.

```console
03/06 Update repository components
   - Updated CHANGELOG.md file
   - Updated version.txt file

04/06 Release Python packages
   - Released hello-plone: 1.1.0

05/06 Commit changes, create tag
   - Created tag 1.1.0

06/06 Summary and goodbye
   - Completed the release of version 1.1.0 from version 1.0.0
```

(tutorial-first-release-result)=

## Look at the result

Read the changelog.

```shell
cat CHANGELOG.md
```

```markdown
# Changelog

<!-- towncrier release notes start -->

## 1.1.0 (2026-12-03)

### Features

- Say hello to Plone. (#1)
```

The news fragment is now a changelog entry, and the file `news/1.feature` is gone.

Look at the history and the tags.

```shell
git log --oneline
git tag
```

```console
9a06bcb Release 1.1.0
9559186 Start hello-plone
1.1.0
```

repoplone committed the release as `Release 1.1.0` and tagged it `1.1.0`.
`version.txt` and `src/hello_plone/__init__.py` both hold `1.1.0`.

You have released a package with repoplone.
A real project adds a remote, a GitHub release, and packages that get published, and the steps stay the same.

```{seealso}
- {doc}`/how-to/release`, to release a real project.
- {doc}`/explanation/release-pipeline`, for what each step did and why.
- {doc}`/reference/repository-toml`, for every key of the file you wrote.
```
