Skip to content

release.publish

Publish a built release: repository, tag, Pages, Docker image, GitHub release.

Every step checks whether it is already done and is skipped then, so a publish which failed half way is finished by running the command again. The tools are the real git, gh and docker command line programs, called through a Runner.

DOCKER_PLATFORM module-attribute

DOCKER_PLATFORM = 'linux/amd64'

The platform of the Docker image of a release.

check_tools

check_tools(release_path, runner=run)

Check that the tools of the publishing steps are ready.

The check needs no build, so a release runs it before the build.

Parameters:

Name Type Description Default
release_path Path

the checkout of the release repository.

required
runner Runner

runs the tool checks.

run

Raises:

Type Description
ReleaseError

if Docker or its buildx plugin is not available or gh is not logged in; one message lists every problem.

check_lock

check_lock(release_path)

Check that the built project depends on released packages only.

Parameters:

Name Type Description Default
release_path Path

the checkout of the release repository, after the build.

required

Raises:

Type Description
ReleaseError

if there is no uv.lock, the lock has a package which is not from PyPI or the project uses tool.uv.sources; one message lists everything.

head_is_release

head_is_release(path, version, runner=run)

Tell whether the release of a version is committed at HEAD.

Parameters:

Name Type Description Default
path Path

the checkout of the release repository.

required
version str

the released version.

required
runner Runner

runs git.

run

Returns:

Type Description
bool

True if the working tree is clean and the release.json of HEAD is

bool

the manifest of version.

tag_commit

tag_commit(path, version, runner=run)

Get the commit of the tag of a version.

Parameters:

Name Type Description Default
path Path

the checkout of the release repository.

required
version str

the version, the name of the tag.

required
runner Runner

runs git.

run

Returns:

Type Description
str | None

The commit of refs/tags/<version>, None without the tag.

publish

publish(
    settings, release_path, version, archive, runner=run
)

Publish a built release; every step already done is skipped.

The Docker image is built first, so an image which does not build stops the release before anything is published. GitHub Pages is set up before the push, so the docs workflow which the push starts deploys the site.

Parameters:

Name Type Description Default
settings ReleaseSettings

the release settings of the model.

required
release_path Path

the checkout of the release repository.

required
version str

the released version.

required
archive Path

the source archive attached to the GitHub release.

required
runner Runner

runs git, gh and docker.

run

Returns:

Type Description
list[str]

The names of the steps which ran: image, commit, tag, pages,

list[str]

push, docker, github_release.

Raises:

Type Description
ReleaseError

if a command fails or the tag exists at another commit.