Release steps#
This page lists the built-in steps of repoplone release and the contract of a step of your own.
Built-in steps#
The steps run in this order unless [repository.release] steps sets another.
Id |
Title |
Runs when |
|---|---|---|
|
Display Changelog |
always |
|
Next version |
always |
|
Update repository components |
always |
|
Release Python packages |
the repository has an enabled Python package |
|
Release Node packages |
the repository has an enabled Node package |
|
Commit changes, create tag |
always |
|
Create GitHub release |
always |
|
Summary and goodbye |
always |
repoplone settings release-steps prints the configured order.
A step that fails stops the release with Release failed: Release step <id> failed. and exit code 1.
Checks before the first step#
These checks run before the first step, in a dry run too.
Check |
Applies when |
On failure |
|---|---|---|
PyPI authentication: |
a Python package has |
error, exit code 1 |
npm authentication: |
a Node package has |
error, exit code 1 |
The repository changelog exists and has the line |
repoplone writes the repository changelog itself, not a package at the root |
error, exit code 1 |
No tracked file has uncommitted changes |
always |
error, exit code 1; a warning in a dry run or with |
The |
always |
warning |
|
always |
warning |
After a warning, repoplone asks Do you want to continue the release?.
Answering no exits with code 0.
The git step commits every tracked change.
A restart with --start-step follows steps that already changed files.
There, uncommitted changes only give a warning.
Check that the warning lists only files the release wrote.
What each step does#
changelogBuilds the draft of the repository changelog entry from the news fragments, and prints it. Asks
Continue?. Writes nothing.versionComputes the next version from the
desired_versionargument. Without the argument, a semver repository shows a menu of versions, and a calver repository computes the next one. Fails when the version is not valid, is not higher than the current one, or already exists as a git tag. Writes nothing.repositoryWrites the changelog entry to the repository changelog, after the line
<!-- towncrier release notes start -->. Deletes the repository’s news fragments when[repository.towncrier]exists. Writes the new version to theversionfile. In eachcomposefile, replaces the old version with the new one in image tags. It only changesimage:lines that containcontainer_images_prefix, or everyimage:line when the prefix is empty. A tag can be the plain version, such asapp-backend:1.0.0, or a variable default, such asapp-backend:${VERSION:-1.0.0}.release_pythonFor each enabled Python package, in file order: compiles its
.pofiles, sets its version with hatch, builds its changelog with towncrier and deletes its news fragments, and copies that changelog to each component whosechangelog_packagenames the package. Withpublish = true, it then emptiesdist/, runsuv build, and runsuv publish. It skips a package whose version is already on PyPI.release_nodeFor each enabled Node package, converts the version to semantic versioning syntax, such as
1.0.0-alpha.1. Withpublish = false, it writes the version topackage.json, builds the changelog with towncrier, and copies it to components as above. Withpublish = true, it runsnpx release-it --ci --no-git --no-github.releasein the package folder. It skips a package whose version is already on npm.gitRuns
git commit -am "Release <version>". Creates the annotated tag<version>, without avprefix. Pushes the branch, then the tag, toorigin.gh_releaseCreates a GitHub release for the tag, with the repository changelog entry as its body. Without a token, or when
originis not on GitHub, it prints a message and goes on. The token comes fromGITHUB_TOKEN, or fromgh auth tokenafter a confirmation in an interactive terminal.byePrints
Completed the release of version <new> from version <old>.
Dry run#
repoplone release --dry-run runs every step with these differences.
Step |
In a dry run |
|---|---|
|
Same as a release. |
|
Same as a release. |
|
Prints |
|
Runs |
|
Runs |
|
Skipped. |
|
Skipped. |
|
Same as a release. |
A dry run leaves a dist/ folder in each Python package with publish = true.
Restarting a release#
--start-step <id> skips the steps before <id>.
The release prints them as (skipped).
--start-step also accepts the specification 1 ids release_backend and release_frontend.
When the start step comes after version, give the version as the desired_version argument.
A version equal to the content of the version file is used as it is.
This is the case once repository has run.
Any other version must be higher than the content of the version file, and must not exist as a tag.
The package steps skip each package already published at that version. A restart therefore does not upload a package twice.
local_step#
A registry entry with function = "local_step" calls a function of your own.
[repository.release.registry.notify]
function = "local_step"
title = "Notify the team"
args = { entrypoint = "scripts.release:notify", channel = "releases" }
args.entrypointRequired. The form is
module.path:callable. repoplone puts the root of the repository first onsys.pathbefore it imports the module.- Other keys of
args Passed to the callable as keyword arguments.
The callable has this signature.
def notify(step_id, title, settings, state, **kwargs) -> bool:
if state.dry_run:
return True
channel = kwargs["channel"]
print(f"Released {state.next_version}, telling {channel}")
return True
Argument |
Value |
|---|---|
|
The registry key, such as |
|
The step title. |
|
The repository settings. |
|
The release state. See the next table. |
|
Value |
|---|---|
|
|
|
The version before the release. |
|
The new version, once |
|
|
A return value that is false fails the release.
repoplone settings sanity-check imports every entrypoint and reports the ones that fail.
See also
The release pipeline, for why the release is a list of steps.
Customize the release, to add, drop, or reorder steps.
repoplone release, for the options of the command.