Skip to content

Instantly share code, notes, and snippets.

@djhunter67
Last active November 10, 2022 19:56
Show Gist options
  • Save djhunter67/d7b87f42d13bbfdd44ed5e767f1184ce to your computer and use it in GitHub Desktop.
Save djhunter67/d7b87f42d13bbfdd44ed5e767f1184ce to your computer and use it in GitHub Desktop.
ROOT = pathlib.Path(__file__).resolve().parent.parent.parent
WORKING = ROOT / "src" / "gui"
def version_getter() -> str | None:
"""Get the latest version from the CHANGELOG file"""
with open(ROOT / "CHANGELOG.md", "r") as f:
for line in f:
if line.__contains__("##") and not line.__contains__("YEAR MONTH DAY"):
correct_line = line.split("-")[0].strip()
version = correct_line.split("[")[1]
return version.strip("]")
@djhunter67
Copy link
Author

This will get the version from the specific file type I use for changelogs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment