Skip to content

Commit 9be1664

Browse files
committed
setup.py
1 parent 46e4deb commit 9be1664

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

setup.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,22 @@
1212
with open("./requirements.txt" , 'r', encoding="utf-8") as rf:
1313
req = rf.readlines()
1414

15-
version = ""
16-
with open("./version.txt", "r", encoding="utf-8") as rf:
17-
version = rf.read().strip()
18-
1915
optional_install = None
2016
with open("./optional.json", "r", encoding="utf-8") as rf:
2117
optional_install = json.load(rf)
2218

19+
# Parse version
20+
gh_release = os.environ.get("GITHUB_REF_NAME", default=None) # Workflow run release
21+
readthedocs_release = os.environ.get("READTHEDOCS_VERSION", default=None) # Readthe docs version
22+
23+
version = None
24+
if gh_release is not None:
25+
version = gh_release
26+
elif readthedocs_release is not None:
27+
version = readthedocs_release
28+
else:
29+
with open("./version.txt", "r", encoding="utf-8") as rf:
30+
version = rf.read().strip()
2331

2432

2533
__metadata__ = \

0 commit comments

Comments
 (0)