Skip to content

Commit

Permalink
Replace VERSION variable with setuptools_scm for versioning (#57)
Browse files Browse the repository at this point in the history
* Use setuptools_scm instead of env for version handling
* Update Github Actions

Signed-off-by: <contact@nlach.fr>
  • Loading branch information
nlachfr authored Apr 12, 2023
1 parent 1b03496 commit b31fb7a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/on-release-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install setuptools setuptools_scm wheel twine
- name: Publish to Pypi
run: |
rm -rf dist; VERSION=${{ env.glustercli_version }} python3 setup.py sdist bdist_wheel;
rm -rf dist; python3 setup.py sdist bdist_wheel;
TWINE_PASSWORD=${{ secrets.TWINE_PASSWORD }} twine upload --username aravindavk dist/*
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ pycscope.*
build
dist
docs/_build
glustercli/_version.py
.DS_Store
_build
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build-system]
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "glustercli/_version.py"
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import os
import re
from setuptools import setup
from importlib.metadata import version, PackageNotFoundError

VERSION = os.environ.get("VERSION", "master")

try:
__version__ = version('glustercli')
except PackageNotFoundError:
__version__ = "unknown"

setup(
name='glustercli',
version=VERSION,
version=__version__,
description='Python bindings for GlusterFS CLI and Metrics collection',
license='GPLv2 or LGPLv3+',
author='Aravinda Vishwanathapura',
Expand Down

0 comments on commit b31fb7a

Please sign in to comment.