diff --git a/.github/workflows/publish-release-to-pypi.yaml b/.github/workflows/publish-release-to-pypi.yaml index 7e5cd76..42991d0 100644 --- a/.github/workflows/publish-release-to-pypi.yaml +++ b/.github/workflows/publish-release-to-pypi.yaml @@ -20,16 +20,15 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: '3.x' + python-version: "3.x" - name: Install Python dependencies run: | python -m pip install --upgrade pip - pip install -U setuptools wheel twine + pip install -U -r requirements_release.txt - name: Build and publish release env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - if [ -z ${{ github.event.inputs.version }} ]; then VERSION=${{ github.event.release.tag_name }}; else VERSION=${{ github.event.inputs.version }}; fi - python setup.py sdist bdist_wheel $VERSION - twine upload dist/* \ No newline at end of file + python setup.py sdist bdist_wheel + twine upload dist/* diff --git a/requirements.txt b/requirements.txt index f229360..822cd79 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -requests +requests >= 2.32.3 diff --git a/requirements_release.txt b/requirements_release.txt new file mode 100644 index 0000000..fb4e241 --- /dev/null +++ b/requirements_release.txt @@ -0,0 +1,4 @@ +setuptools >= 74.1.0 +setuptools_git_versioning >= 2.0.0 +twine >= 5.1.1 +wheel >= 0.44.0 diff --git a/setup.py b/setup.py index 50394eb..208a1f1 100644 --- a/setup.py +++ b/setup.py @@ -1,19 +1,11 @@ -import sys -from setuptools import setup +import setuptools from pathlib import Path # read the contents of your README file current_directory = Path(__file__).parent long_description = (current_directory / "README.md").read_text() -version = sys.argv[3:] -if version: - version = str(version[0]) - sys.argv.remove(version) -else: - raise Exception("Version is not set") - -setup( +setuptools.setup( name="ThermiaOnlineAPI", packages=[ "ThermiaOnlineAPI", @@ -22,7 +14,10 @@ "ThermiaOnlineAPI.model", "ThermiaOnlineAPI.utils", ], - version=version, + setuptools_git_versioning={ + "enabled": True, + "dev_template": "{tag}", + }, license="GPL-3.0", description="A Python API for Thermia heat pumps using https://online.thermia.se", long_description=long_description, @@ -33,5 +28,6 @@ download_url="https://github.com/klejejs/python-thermia-online-api/releases", keywords=["Thermia", "Online"], install_requires=[], + setup_requires=["setuptools-git-versioning"], classifiers=[], )