---
myst:
  html_meta:
    "description": "About versions in repoplone: one version per repository, semver and calver formats, bump keywords, and how a Python version becomes a Node version."
    "property=og:description": "About versions in repoplone: one version per repository, semver and calver formats, bump keywords, and how a Python version becomes a Node version."
    "property=og:title": "Versioning"
    "keywords": "Plone, repoplone, version, semver, calver, PEP 440, npm"
---

(versioning)=

# Versioning

repoplone gives a repository one version and writes it to every package.
This page explains why, how repoplone computes the next version, and how one version fits two ecosystems.

(versioning-one)=

## One version for the repository

A Plone project ships as a whole.
The backend image and the frontend image of a release are tested together, deployed together, and rolled back together.
Separate versions per package would tell the reader nothing the repository version does not.
They would also add a question to every release: which numbers move?

repoplone keeps the version of the repository in the `version` file, usually `version.txt`.
A release writes the new version to that file, to every package, to the compose files, and to the git tag.
The tag has no `v` prefix: version `1.2.0` gets the tag `1.2.0`.

`repoplone versions current` shows the version of the repository and of each package.
After a release, they match.

(versioning-formats)=

## Two formats

`[repository] version_format` picks one of two formats.

`semver`
: The default.
  Versions follow [PEP 440](https://peps.python.org/pep-0440/), such as `1.2.0` or `2.0.0a3`.
  You choose how the version moves at each release.
  This suits add-ons and products, where the version tells users what changed.

`calver`
: Versions are `YYYYMMDD.N`, such as `20261203.1`.
  The date is the day of the release, and `N` counts the releases of that day.
  repoplone computes the next version without asking.
  This suits sites that deploy often, where the date says more than a feature number.

(versioning-bumps)=

## Bump keywords

In a semver repository, you name the change instead of the version.
repoplone delegates the arithmetic to hatch, the build backend that Plone packages use.

<!-- source: src/repoplone/utils/versions/semver.py, BUMPS; hatchling StandardScheme -->

| Keyword | Aliases | From `1.0.0` | From `1.0.0a1` |
|---|---|---|---|
| `major` | | `2.0.0` | `2.0.0` |
| `minor` | | `1.1.0` | `1.1.0` |
| `micro` | `patch`, `fix` | `1.0.1` | `1.0.1` |
| `a` | `alpha` | `1.0.0a0` | `1.0.0a2` |
| `b` | `beta` | `1.0.0b0` | `1.0.0b0` |
| `rc` | `c`, `pre`, `preview` | `1.0.0rc0` | `1.0.0rc0` |
| `release` | | `1.0.0` | `1.0.0` |
| `post` | `r`, `rev` | `1.0.0.post0` | `1.0.0a1.post0` |
| `dev` | | `1.0.0.dev0` | `1.0.0a1.dev0` |

Keywords combine with a comma.
`minor,a` moves `1.0.0` to `1.1.0a0`, the first alpha of the next minor version.
An explicit version such as `2.0.0` also works, as long as it is higher than the current one.

`repoplone versions next` prints the result of each keyword for the current version.
Run it before a release to pick the keyword you mean.

Without a keyword, `repoplone release` offers a short menu that fits the current version.
From a final version, it offers `micro`, `minor`, `major`, `minor,a`, and `major,a`.
From an alpha, it offers `a`, `b`, and `release`.

(versioning-node)=

## One version, two syntaxes

Python and Node spell prereleases differently.
PEP 440 writes `1.0.0a1`.
npm expects semantic versioning and writes `1.0.0-alpha.1`.

repoplone keeps the PEP 440 form as the repository version.
When it releases a Node package, it converts the version.

<!-- source: src/repoplone/utils/versions/__init__.py, convert_python_node_version -->

| Repository version | Node package version |
|---|---|
| `1.0.0` | `1.0.0` |
| `1.0` | `1.0.0` |
| `1.0.0a1` | `1.0.0-alpha.1` |
| `1.0.0b2` | `1.0.0-beta.2` |
| `1.0.0rc1` | `1.0.0-rc.1` |
| `1.0.0.dev3` | `1.0.0+3` |
| `1.0.0.post1` | `1.0.0` |

A post release has no semantic versioning form.
In a repository with Node packages, repoplone refuses a post release before anything is written.
Without that check, a Node package would publish a version it already has.
Use another bump in a repository with Node packages.

The conversion runs the other way where a Node version comes in.
`repoplone deps upgrade` takes a Volto version in semantic versioning syntax, such as `19.0.0-alpha.7`.
It refuses `19.0.0a7`, and suggests the right spelling.

```{seealso}
- {ref}`cli-versions`, for the `versions` commands.
- {doc}`release-pipeline`, for where the version step sits in a release.
```
