-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #329 from meaningfy-ws/feature/MWB-838
Updated app version provider
- Loading branch information
Showing
6 changed files
with
54 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import subprocess | ||
|
||
|
||
def get_current_app_tag(): | ||
try: | ||
# Get the tag of the current commit (if any) | ||
current_tag = subprocess.check_output(["git", "describe", "--exact-match", "--tags"]).strip().decode('utf-8') | ||
return current_tag | ||
except subprocess.CalledProcessError as e: | ||
return None | ||
|
||
|
||
def get_current_app_branch(): | ||
try: | ||
return subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"]).strip().decode('utf-8') | ||
except subprocess.CalledProcessError: | ||
return None | ||
|
||
|
||
def get_current_app_tag_or_branch(): | ||
tag = get_current_app_tag() | ||
if tag: | ||
return tag | ||
else: | ||
branch = get_current_app_branch() | ||
if branch: | ||
return branch | ||
else: | ||
return None | ||
|
||
|
||
def get_current_app_version(): | ||
return get_current_app_tag_or_branch() | ||
|
||
|
||
if __name__ == "__main__": | ||
print(get_current_app_version()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +0,0 @@ | ||
import subprocess | ||
|
||
|
||
def get_current_app_tag(): | ||
try: | ||
# Get the tag of the current commit (if any) | ||
current_tag = subprocess.check_output(["git", "describe", "--exact-match", "--tags"]).strip().decode('utf-8') | ||
return current_tag | ||
except subprocess.CalledProcessError as e: | ||
return None | ||
|
||
|
||
def get_current_app_branch(): | ||
try: | ||
return subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"]).strip().decode('utf-8') | ||
except subprocess.CalledProcessError: | ||
return None | ||
|
||
|
||
def get_current_app_tag_or_branch(): | ||
tag = get_current_app_tag() | ||
if tag: | ||
return tag | ||
else: | ||
branch = get_current_app_branch() | ||
if branch: | ||
return branch | ||
else: | ||
return None | ||
|
||
def get_current_app_version(): | ||
return get_current_app_tag_or_branch() | ||