From 5d6f454ab3bfc0b702d33f192f9b487421b4029d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 11 Apr 2025 17:27:46 +0530 Subject: [PATCH] Add a check to prevent accidentally releasing a preview as the main release --- setup/publish.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup/publish.py b/setup/publish.py index 679db64dcd..eb002ebedc 100644 --- a/setup/publish.py +++ b/setup/publish.py @@ -105,6 +105,9 @@ class Publish(Command): def pre_sub_commands(self, opts): require_git_master() require_clean_git() + version = tuple(map(int, __version__.split('.'))) # noqa: RUF048 + if version[2] > 99: + raise SystemExit('The version number indicates a preview release, did you mean to run ./setup.py publish_preview?') if 'PUBLISH_BUILD_DONE' not in os.environ: subprocess.check_call([sys.executable, 'setup.py', 'check']) subprocess.check_call([sys.executable, 'setup.py', 'build'])