Skip to content

Commit

Permalink
[GHA] Parse product version for manifest in tokenizers & genai
Browse files Browse the repository at this point in the history
Signed-off-by: Alina Kladieva <alina.kladieva@intel.com>
  • Loading branch information
akladiev committed Feb 23, 2025
1 parent f77ef0f commit 1c4a25a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/actions/create_manifest/create_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import git
import sys

import toml

from manifest_manager import Manifest, Repository, Component

sys.path.append(str(Path(__file__).parents[1]))
Expand Down Expand Up @@ -80,6 +82,19 @@ def parse_ov_version(header_file: str | Path) -> str:
return f"{major}.{minor}.{patch}"


def parse_ov_version_from_toml(toml_file_path: str | Path) -> str:
"""
Reads the version field under the [project] section from a pyproject.toml.
:param toml_file_path: Path to the .toml file
:return: Version string
"""
toml_content = Path(toml_file_path).read_text()
toml_data = toml.loads(toml_content)
version = toml_data['project']['version']
return version


def generate_manifest(repos: list, product_type: str, event_type: str, build_type: str, target_arch: str) -> Manifest:
manifest = Manifest()
component_name = 'dldt' # historical, keep for internal compatibility
Expand All @@ -93,6 +108,9 @@ def generate_manifest(repos: list, product_type: str, event_type: str, build_typ
if repo.name == 'openvino':
version_file = Path(repo_dir) / 'src' / 'core' / 'include' / 'openvino' / 'core' / 'version.hpp'
ov_version = parse_ov_version(version_file)
elif repo.name in ['openvino_tokenizers', 'openvino.genai']:
version_file = Path(repo_dir) / 'pyproject.toml'
ov_version = parse_ov_version_from_toml(version_file)
if repo.trigger:
trigger_repo = repo

Expand Down
1 change: 1 addition & 0 deletions .github/actions/create_manifest/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
GitPython~=3.1.43
pyyaml~=6.0.1
toml~=0.10.2

0 comments on commit 1c4a25a

Please sign in to comment.