Bladeren bron

fix update_pyproject.py (#2345)

Falko Schindler 1 jaar geleden
bovenliggende
commit
ccab1812fd
2 gewijzigde bestanden met toevoegingen van 10 en 3 verwijderingen
  1. 9 2
      .github/workflows/update_pyproject.py
  2. 1 1
      pyproject.toml

+ 9 - 2
.github/workflows/update_pyproject.py

@@ -1,10 +1,17 @@
 #!/usr/bin/env python3
 import re
-import sys
+import subprocess
 from pathlib import Path
 
+VERSION_PATTERN = re.compile(r'v[0-9]+\.[0-9]+\.[0-9]+')
+
 if __name__ == '__main__':
+    command = 'git describe --tags $(git rev-list --tags --max-count=100)'
+    tags = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, shell=True, check=True) \
+        .stdout.strip().splitlines()
+    version = next(tag for tag in tags if VERSION_PATTERN.fullmatch(tag)).removeprefix('v')
+
     path = Path('pyproject.toml')
     content = path.read_text(encoding='utf-8')
-    content = re.sub(r'version = "[0-9]+\.[0-9]+\.[0-9]+-dev"', f'version = "{sys.argv[1]}-dev"', content)
+    content = re.sub(r'version = "[0-9]+\.[0-9]+\.[0-9]+-dev"', f'version = "{version}-dev"', content)
     path.write_text(content, encoding='utf-8')

+ 1 - 1
pyproject.toml

@@ -1,6 +1,6 @@
 [tool.poetry]
 name = "nicegui"
-version = "1.4.10-dev"
+version = "1.4.11-dev"
 description = "Create web-based user interfaces with Python. The nice way."
 authors = ["Zauberzeug GmbH <info@zauberzeug.com>"]
 license = "MIT"