mirror of
https://github.com/saymrwulf/cryptography.git
synced 2026-05-14 20:37:55 +00:00
Simplify the release process: No need to pass the version to release.py (#9990)
This commit is contained in:
parent
d81fd662f7
commit
a8b96dab9b
2 changed files with 8 additions and 10 deletions
|
|
@ -50,10 +50,10 @@ Performing the release
|
|||
----------------------
|
||||
|
||||
The commit that merged the version number bump is now the official release
|
||||
commit for this release. You will need to have ``gpg`` installed and a ``gpg``
|
||||
key in order to do a release. Once this has happened:
|
||||
commit for this release. You will need to have ``git`` configured to perform
|
||||
signed tags. Once this has happened:
|
||||
|
||||
* Run ``python release.py release {version}``.
|
||||
* Run ``python release.py release``.
|
||||
|
||||
The release should now be available on PyPI and a tag should be available in
|
||||
the repository.
|
||||
|
|
|
|||
12
release.py
12
release.py
|
|
@ -8,6 +8,7 @@ import subprocess
|
|||
|
||||
import click
|
||||
import tomllib
|
||||
from packaging.version import Version
|
||||
|
||||
|
||||
def run(*args: str) -> None:
|
||||
|
|
@ -22,18 +23,15 @@ def cli():
|
|||
|
||||
@cli.command()
|
||||
@click.argument("version")
|
||||
def release(version: str) -> None:
|
||||
"""
|
||||
``version`` should be a string like '0.4' or '1.0'.
|
||||
"""
|
||||
def release() -> None:
|
||||
base_dir = pathlib.Path(__file__).parent
|
||||
with (base_dir / "pyproject.toml").open("rb") as f:
|
||||
pyproject = tomllib.load(f)
|
||||
pyproject_version = pyproject["project"]["version"]
|
||||
version = pyproject["project"]["version"]
|
||||
|
||||
if version != pyproject_version:
|
||||
if Version(version).is_prerelease:
|
||||
raise RuntimeError(
|
||||
f"Version mismatch: pyproject.toml has {pyproject_version}"
|
||||
f"Can't release, pyproject.toml version is pre-release: {version}"
|
||||
)
|
||||
|
||||
# Tag and push the tag (this will trigger the wheel builder in Actions)
|
||||
|
|
|
|||
Loading…
Reference in a new issue