Skip to content

Commit 90bce69

Browse files
committed
Adds fallback version tagging for untagged commits
1 parent 1693125 commit 90bce69

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

.github/workflows/test-code.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,19 @@ jobs:
197197
export PYTHONPATH="$(pwd)/src${PYTHONPATH:+:$PYTHONPATH}"
198198
python -m pytest tests/functional_tests/ --color=yes -n auto
199199
200+
# Ensures a consistent high version like 999.0.0 when not on a tagged commit
201+
# This is needed for testing the package in the next job, as its version
202+
# must be higher than the PyPI version for pip to prefer the local version.
203+
- name: Inject fallback version tag if not on a real tag
204+
shell: bash
205+
run: |
206+
if ! git describe --tags --match "v*" --exact-match > /dev/null 2>&1; then
207+
echo "Not on release tag — applying fallback 'v999.0.0'"
208+
git tag v999.0.0
209+
else
210+
echo "On a valid tag"
211+
fi
212+
200213
- name: Create Python package for the next job
201214
shell: bash
202215
run: python -m build --wheel --outdir dist

pyproject.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,6 @@ allow-direct-references = true
104104
[tool.hatch.version]
105105
source = 'versioningit' # Use versioningit to manage the version
106106

107-
# Override the version used specifically during build time (e.g., in CI)
108-
# - Ensures a consistent high version like 999.0.0 when not on a tagged commit
109-
[tool.hatch.build.hooks.versioningit-onbuild]
110-
method = 'literal'
111-
version = '999.0.0'
112-
113107
################################
114108
# Configuration for versioningit
115109
################################

0 commit comments

Comments
 (0)