Skip to content

Commit 3a14f24

Browse files
authored
Fix release version number for non-manual releases. (#595)
1 parent aa7ea1b commit 3a14f24

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.github/workflows/release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,6 @@ jobs:
129129
python --version
130130
python -m pip install delocate wheel setuptools numpy six --no-cache-dir
131131
132-
export LCE_RELEASE_VERSION=${{ github.event.inputs.version }}
133-
134132
./configure.py
135133
136134
bazelisk build :build_pip_pkg --copt=-fvisibility=hidden --copt=-mavx --copt=-mmacosx-version-min=10.13 --linkopt=-mmacosx-version-min=10.13 --linkopt=-dead_strip --distinct_host_configuration=false
@@ -139,6 +137,8 @@ jobs:
139137
for f in artifacts/*.whl; do
140138
delocate-wheel -w wheelhouse $f
141139
done
140+
env:
141+
LCE_RELEASE_VERSION: ${{ github.event.inputs.version }}
142142
shell: bash
143143
- uses: actions/upload-artifact@v2
144144
with:

setup.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,19 @@ def has_ext_modules(self):
1717
return True
1818

1919

20+
def get_version_number(default):
21+
# The `or default` is because on CI the `getenv` can return the empty string.
22+
version = os.getenv("LCE_RELEASE_VERSION", default) or default
23+
if "." not in version:
24+
raise ValueError(f"Invalid version: {version}")
25+
return version
26+
27+
2028
ext_modules = [Extension("_foo", ["stub.cc"])] if platform.startswith("linux") else []
2129

2230
setup(
2331
name="larq-compute-engine",
24-
version=os.getenv("LCE_RELEASE_VERSION", "0.5.0"),
32+
version=get_version_number(default="0.5.0"),
2533
python_requires=">=3.6",
2634
description="Highly optimized inference engine for binarized neural networks.",
2735
long_description=readme(),

0 commit comments

Comments
 (0)