Skip to content

Commit

Permalink
Fix release script check of version overview.
Browse files Browse the repository at this point in the history
  • Loading branch information
fniessink committed Jul 5, 2024
1 parent af7b7d0 commit c0e83fc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion docs/src/versioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The table below contains the *Quality-time* releases since the last minor of the

| Version | Date | Mongo | FC | Migrations | Downgrade | Upgrade |
|------------|--------------|--------|--------|------------|----------------|-----------------|
| v5.14.0 | (unreleased) | v7 | **v7** | added | not possible | n/a |
| v5.14.0 | 2024-07-05 | v7 | **v7** | added | not possible | n/a |
| v5.13.0 | 2024-05-23 | v7 | v6 | added | not possible | v5.14.0 |
| v5.12.0 | 2024-05-17 | v7 | v6 | added | not possible | v5.13.0-v5.14.0 |
| v5.11.0 | 2024-04-22 | v7 | v6 | | v5.6.0-v5.10.0 | v5.12.0-v5.14.0 |
Expand Down
31 changes: 16 additions & 15 deletions release/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,24 +124,25 @@ def failed_preconditions_changelog(bump: str, root: pathlib.Path) -> list[str]:


def failed_preconditions_version_overview(current_version: str, root: pathlib.Path) -> list[str]:
"""Check that the version overview is properly prepared."""
"""Check that the version overview contains the new version.
Note: this check is only run when the version bump is 'release'.
"""
version_overview = root / "docs" / "src" / "versioning.md"
with version_overview.open() as version_overview_file:
version_overview_lines = version_overview_file.readlines()
missing = f"The version overview ({version_overview}) does not contain"
previous_line = ""
latest_version_line = next(line for line in version_overview_file if re.match(r"\| \*?\*?v\d+", line))
columns = latest_version_line.split(" | ")
latest_version = columns[0].strip("| v")
release_date = columns[1].strip("| ")
target_version = current_version.split("-rc.")[0]
for line in version_overview_lines:
if line.startswith(f"| v{target_version} "):
if previous_line.startswith("| v"):
today = utc_today().isoformat()
release_date = previous_line.split(" | ")[1].strip()
if release_date != today: # Second column is the release date column
return [f"{missing} the release date. Expected today: '{today}', found: '{release_date}'."]
return [] # All good: current version, next version, and release date found
return [f"{missing} the new version."]
previous_line = line
return [f"{missing} the target version ({target_version})."]
messages = []
today = utc_today().isoformat()
missing = f"The first line of the version overview table ({version_overview}) does not contain"
if release_date != today:
messages.append(f"{missing} the release date. Expected today: '{today}', found: '{release_date}'.")
if latest_version != target_version:
messages.append(f"{missing} the new version. Expected: '{target_version}', found: '{latest_version}'.")
return messages


def utc_today() -> datetime.date:
Expand Down

0 comments on commit c0e83fc

Please sign in to comment.