Skip to content

Commit 83168cd

Browse files
authored
Block release if git unclean (#366)
* Stop release process if repo is not clean * Update test_release_date Now can match versions with alphanumeric suffixes * Give last chance to cancel upload after build * Bump version to 1.4.4.post2
1 parent 4bd08bb commit 83168cd

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

aiosmtpd/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import warnings
55

66

7-
__version__ = "1.4.4"
7+
__version__ = "1.4.4.post2"
88

99

1010
def _get_or_new_eventloop() -> asyncio.AbstractEventLoop:

aiosmtpd/docs/NEWS.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ Fixed/Improved
1616
* A whole bunch of annotations
1717

1818

19+
1.4.4.post2 (2023-01-19)
20+
========================
21+
22+
Fixed/Improved
23+
--------------
24+
* Prevent unclean repo from being built (Closes #365)
25+
* Reduce chance of not-ready-for-release packages from being uploaded
26+
27+
1928
1.4.4 (2023-01-17)
2029
==================
2130

aiosmtpd/qa/test_0packaging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from aiosmtpd import __version__
1818

1919
RE_DUNDERVER = re.compile(r"__version__\s*?=\s*?(['\"])(?P<ver>[^'\"]+)\1\s*$")
20-
RE_VERHEADING = re.compile(r"(?P<ver>[0-9.]+)\s*\((?P<date>[^)]+)\)")
20+
RE_VERHEADING = re.compile(r"(?P<ver>([0-9.]+)\S*)\s*\((?P<date>[^)]+)\)")
2121

2222

2323
@pytest.fixture

release.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
printfl = partial(print, flush=True)
2020
run_hidden = partial(subprocess.run, stdout=subprocess.PIPE)
2121

22+
result = run_hidden(shlex.split("git status --porcelain"))
23+
if result.stdout:
24+
print("git is not clean!")
25+
print("Please commit/shelf first before releasing!")
26+
sys.exit(1)
27+
2228
TWINE_CONFIG = Path(os.environ.get("TWINE_CONFIG", "~/.pypirc")).expanduser()
2329
TWINE_REPO = os.environ.get("TWINE_REPOSITORY", "aiosmtpd")
2430
UPSTREAM_REMOTE = os.environ.get("UPSTREAM_REMOTE", "upstream")
@@ -101,7 +107,16 @@
101107
# Assuming twine is installed.
102108
print("### twine check")
103109
subprocess.run(["twine", "check"] + DISTFILES, check=True)
110+
except subprocess.CalledProcessError as e:
111+
print("ERROR: Last step returned exitcode != 0")
112+
sys.exit(e.returncode)
113+
114+
choice = input("Ready to upload to PyPI? [y/N]: ")
115+
if choice.casefold() not in ("y", "yes"):
116+
print("Okay.")
117+
sys.exit(0)
104118

119+
try:
105120
# You should have an aiosmtpd bit setup in your ~/.pypirc - for twine
106121
twine_up = f"twine upload --config-file {TWINE_CONFIG} -r {TWINE_REPO}".split()
107122
if GPG_SIGNING_ID:

0 commit comments

Comments
 (0)