Skip to content

Commit

Permalink
Relax major version check for pre-releases (microsoft#22734)
Browse files Browse the repository at this point in the history
  • Loading branch information
karthiknadig authored Jan 10, 2024
1 parent 3e75937 commit d7be806
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion build/update_ext_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,23 @@ def main(package_json: pathlib.Path, argv: Sequence[str]) -> None:
major, minor, micro, suffix = parse_version(package["version"])

current_year = datetime.datetime.now().year
if int(major) != current_year:
current_month = datetime.datetime.now().month
int_major = int(major)
valid_major = (
int_major
== current_year # Between JAN-DEC major version should be current year
or (
int_major == current_year - 1 and current_month == 1
) # After new years the check is relaxed for JAN to allow releases of previous year DEC
or (
int_major == current_year + 1 and current_month == 12
) # Before new years the check is relaxed for DEC to allow pre-releases of next year JAN
)
if not valid_major:
raise ValueError(
f"Major version [{major}] must be the current year [{current_year}].",
f"If changing major version after new year's, change to {current_year}.1.0",
f"Minor version must be updated based on release or pre-release channel.",
)

if args.release and not is_even(minor):
Expand Down

0 comments on commit d7be806

Please sign in to comment.