Skip to content

Commit e115e94

Browse files
seismanactions-bot
authored andcommitted
Set __commit__ to an empty string for non-dev releases (GenericMappingTools#1174)
* Set __commit__ to an empty string for non-dev releases * Link to tags for non-dev releases Co-authored-by: actions-bot <[email protected]>
1 parent 2759ec2 commit e115e94

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

doc/conf.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,14 @@
150150
html_theme_options = {}
151151
repository = "GenericMappingTools/pygmt"
152152
repository_url = "https://github.com/GenericMappingTools/pygmt"
153-
commit_link = f'<a href="{repository_url}/commit/{ __commit__ }">{ __commit__[:8] }</a>'
153+
if __commit__:
154+
commit_link = (
155+
f'<a href="{repository_url}/commit/{ __commit__ }">{ __commit__[:8] }</a>'
156+
)
157+
else:
158+
commit_link = (
159+
f'<a href="{repository_url}/releases/tag/{ __version__ }">{ __version__ }</a>'
160+
)
154161
html_context = {
155162
"menu_links": [
156163
(

pygmt/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
# Get semantic version through setuptools-scm
4949
__version__ = f'v{get_distribution("pygmt").version}' # e.g. v0.1.2.dev3+g0ab3cd78
50-
__commit__ = __version__.split("+g")[-1] # 0ab3cd78
50+
__commit__ = __version__.split("+g")[-1] if "+g" in __version__ else "" # 0ab3cd78
5151

5252
# Start our global modern mode session
5353
_begin()

0 commit comments

Comments
 (0)