-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add ability to retrieve current version
This script allows to retrieve the current source code version. This functionality will be used later on to bump the version automatically.
- Loading branch information
1 parent
90202df
commit 2f9a340
Showing
2 changed files
with
23 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/python3 | ||
|
||
import importlib | ||
import subprocess | ||
import sys | ||
|
||
# Insert path to roadmapper package in system path | ||
git_repo_root = subprocess.Popen(['/bin/git', 'rev-parse', '--show-toplevel'], stdout=subprocess.PIPE) \ | ||
.communicate()[0] \ | ||
.rstrip() \ | ||
.decode('utf-8') | ||
sys.path.insert(1, git_repo_root) | ||
|
||
|
||
def get_current_version() -> str: | ||
roadmapper_version_module = importlib.import_module("src.roadmapper.version") | ||
current_version = getattr(roadmapper_version_module, "__version__") | ||
return current_version | ||
|
||
|
||
if __name__ == "__main__": | ||
print(get_current_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