use more predictable version numbers

This commit is contained in:
sebthom
2024-01-12 01:41:18 +01:00
parent 7b2dfd8559
commit a87e12bf1b
4 changed files with 21 additions and 7 deletions

13
version.py Normal file
View File

@@ -0,0 +1,13 @@
"""
SPDX-FileCopyrightText: © Sebastian Thomschke and contributors
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-ArtifactOfProjectHomePage: https://github.com/Second-Hand-Friends/kleinanzeigen-bot/
"""
from datetime import datetime
import subprocess
# used in pyproject.toml [tool.pdm.version]
def get_version() -> str:
commit_hash = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode().strip()
return f"{datetime.now().year}+{commit_hash}"