Skip to content

Commit b16a704

Browse files
ko3n1gclaude
andcommitted
build: drop rc0 pre-release tag and add dynamic git versioning
Append +<short-sha> to __version__ at import time using only the git binary. Falls back silently if git is unavailable or not in a repo. Set NO_VCS_VERSION=1 to opt out (e.g. for release builds). Also pins build-test-publish-wheel to FW-CI-templates@7a6fd6d which sets NO_VCS_VERSION=1 in the build step, preventing sdist/wheel version mismatch. Will be replaced with a version tag once NVIDIA-NeMo/FW-CI-templates#443 is released. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: oliver könig <okoenig@nvidia.com>
1 parent 01f16c3 commit b16a704

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

.github/workflows/build-test-publish-wheel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
if: |
4444
!(needs.pre-flight.outputs.docs_only == 'true'
4545
|| needs.pre-flight.outputs.is_deployment_workflow == 'true')
46-
uses: NVIDIA-NeMo/FW-CI-templates/.github/workflows/_build_test_publish_wheel.yml@v0.70.1
46+
uses: NVIDIA-NeMo/FW-CI-templates/.github/workflows/_build_test_publish_wheel.yml@7a6fd6d27f422af24f853346bc738d31af0338c0
4747
with:
4848
dry-run: true
4949
python-package: nemo_export_deploy_common

nemo_export_deploy_common/package_info.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,31 @@
1616
MAJOR = 0
1717
MINOR = 6
1818
PATCH = 0
19-
PRE_RELEASE = "rc0"
19+
PRE_RELEASE = ""
2020

2121
# Use the following formatting: (major, minor, patch, pre-release)
2222
VERSION = (MAJOR, MINOR, PATCH, PRE_RELEASE)
2323

2424
__shortversion__ = ".".join(map(str, VERSION[:3]))
2525
__version__ = ".".join(map(str, VERSION[:3])) + "".join(VERSION[3:])
2626

27+
import os as _os
28+
import subprocess as _subprocess
29+
30+
if not int(_os.getenv("NO_VCS_VERSION", "0")):
31+
try:
32+
_git = _subprocess.run(
33+
["git", "rev-parse", "--short", "HEAD"],
34+
capture_output=True,
35+
cwd=_os.path.dirname(_os.path.abspath(__file__)),
36+
check=True,
37+
universal_newlines=True,
38+
)
39+
except (_subprocess.CalledProcessError, OSError):
40+
pass
41+
else:
42+
__version__ += f"+{_git.stdout.strip()}"
43+
2744
__package_name__ = "nemo_export_deploy"
2845
__contact_names__ = "NVIDIA"
2946
__contact_emails__ = "nemo-toolkit@nvidia.com"

0 commit comments

Comments
 (0)