Skip to content

Commit

Permalink
Fix release version number for non-manual releases. (#595)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamHillier authored Jan 29, 2021
1 parent aa7ea1b commit 3a14f24
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ jobs:
python --version
python -m pip install delocate wheel setuptools numpy six --no-cache-dir
export LCE_RELEASE_VERSION=${{ github.event.inputs.version }}
./configure.py
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
Expand All @@ -139,6 +137,8 @@ jobs:
for f in artifacts/*.whl; do
delocate-wheel -w wheelhouse $f
done
env:
LCE_RELEASE_VERSION: ${{ github.event.inputs.version }}
shell: bash
- uses: actions/upload-artifact@v2
with:
Expand Down
10 changes: 9 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,19 @@ def has_ext_modules(self):
return True


def get_version_number(default):
# The `or default` is because on CI the `getenv` can return the empty string.
version = os.getenv("LCE_RELEASE_VERSION", default) or default
if "." not in version:
raise ValueError(f"Invalid version: {version}")
return version


ext_modules = [Extension("_foo", ["stub.cc"])] if platform.startswith("linux") else []

setup(
name="larq-compute-engine",
version=os.getenv("LCE_RELEASE_VERSION", "0.5.0"),
version=get_version_number(default="0.5.0"),
python_requires=">=3.6",
description="Highly optimized inference engine for binarized neural networks.",
long_description=readme(),
Expand Down

0 comments on commit 3a14f24

Please sign in to comment.