Skip to content

Commit

Permalink
Merged in feature/PROTO-242-Dynamic-version-numbering-for-development…
Browse files Browse the repository at this point in the history
…-builds-v4 (pull request #177)

Read version number from json file with build number.
  • Loading branch information
BartHertog committed Aug 24, 2024
2 parents f58cdef + 558b037 commit 02b4578
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[project]
name = "EmbeddedProto"
dynamic = ["version"]
authors = [
{name = "Embedded AMS B.V.", email = "info@embeddedproto.com"},
]
Expand All @@ -15,7 +16,6 @@ dependencies = [
"six>=1.16.0,<2",
"toposort>=1.7,<2",
]
version = "4.0.0"

[tool.setuptools.packages.find]
where = ["."]
Expand Down
13 changes: 13 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from setuptools import setup
import subprocess
import os
import json


def build_proto():
Expand Down Expand Up @@ -62,10 +63,22 @@ def run(self):
build_proto()
super().run()

def get_version():
version_file = 'version.json'
build_number = os.getenv('GITHUB_RUN_NUMBER', '0')

with open(version_file, 'r') as f:
version_data = json.load(f)

base_version = version_data.get('version', '0.0.0')
full_version = f"{base_version}.dev{build_number}"
return full_version


setup(
cmdclass={
"editable_wheel": EditableWheel,
"sdist": Sdist,
},
version=get_version(),
)
3 changes: 3 additions & 0 deletions version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"version": "4.0.0"
}

0 comments on commit 02b4578

Please sign in to comment.