From 0db7347a9fa4572a1c154e439df26c82d2606d8a Mon Sep 17 00:00:00 2001 From: BrianLusina <12752833+BrianLusina@users.noreply.github.com> Date: Wed, 16 Aug 2023 10:14:01 +0300 Subject: [PATCH] fix(version): dynamic versioning --- kvault/__version__.py | 13 +++++++++++++ pyproject.toml | 10 +++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 kvault/__version__.py diff --git a/kvault/__version__.py b/kvault/__version__.py new file mode 100644 index 0000000..c67373b --- /dev/null +++ b/kvault/__version__.py @@ -0,0 +1,13 @@ +""" +Contains version information about package +""" +import os + +__version__ = os.environ.get( + "PACKAGE_VERSION", + os.environ.get("CI_COMMIT_TAG", + os.environ.get("GITHUB_REF_NAME", + os.environ.get("VERSION", "0.1-dev") + ) + ) +) diff --git a/pyproject.toml b/pyproject.toml index 9084271..6b19844 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,7 @@ [tool.poetry] name = "kvault" -version = "0.1.0" +# This version field is not being used. The version field is dynamicall updated as below +version = "0.0.0" description = "Simple Miniature key-value datastore" authors = ["BrianLusina <12752833+BrianLusina@users.noreply.github.com>"] license = "MIT" @@ -27,6 +28,13 @@ python-dotenv = "^1.0.0" [tool.poetry.group.dev.dependencies] pytest-cov = "^4.1.0" +[tool.setuptools.dynamic] +version = { attr = "kvault.__version__" } + +# Reference: https://github.com/tiangolo/poetry-version-plugin +[tool.poetry-version-plugin] +source = "git-tag" + [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api"