Skip to content

Commit 1d8b3c7

Browse files
committed
Fix: automate getting the release tag
1 parent 53d1af9 commit 1d8b3c7

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

conf.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# import sys
1515
# sys.path.insert(0, os.path.abspath('.'))
1616
from datetime import datetime
17+
import subprocess
1718

1819
current_year = datetime.now().year
1920
organization_name = "pyOpenSci"
@@ -26,8 +27,15 @@
2627
copyright = f"{current_year}, {organization_name}"
2728
author = "pyOpenSci Community"
2829

29-
# The full version, including alpha/beta/rc tags
30-
release = "0.1"
30+
# Get the latest Git tag - there might be a prettier way to do this but...
31+
try:
32+
release_value = subprocess.check_output(["git", "describe", "--tags"]).decode("utf-8").strip()
33+
release_value = release_value[:4]
34+
except subprocess.CalledProcessError:
35+
release_value = "0.1" # Default value in case there's no tag
36+
37+
# Update the release value
38+
release = release_value
3139

3240
# -- General configuration ---------------------------------------------------
3341

0 commit comments

Comments
 (0)