File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 1212with 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-
1915optional_install = None
2016with 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__ = \
You can’t perform that action at this time.
0 commit comments