From cbcef3da90f196c7b062b5930b5b304c9ac6279f Mon Sep 17 00:00:00 2001 From: Gagan Deep Date: Sat, 23 Nov 2024 00:09:52 +0530 Subject: [PATCH 1/2] [ci] Added PyPI release workflow --- .github/workflows/pypi.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/pypi.yml diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 00000000..a2779a09 --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,32 @@ +name: Publish Python Package to Pypi.org + +on: + release: + types: [published] + +permissions: + id-token: write + +jobs: + pypi-publish: + name: Release Python Package on Pypi.org + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/openwisp-monitoring + permissions: + id-token: write + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + - name: Install dependencies + run: | + pip install -U pip + pip install build + - name: Build package + run: python -m build + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@v1.11.0 From 10c08d698a017d4e3b689f61bfcd2d4e14876569 Mon Sep 17 00:00:00 2001 From: Gagan Deep Date: Sat, 23 Nov 2024 00:11:19 +0530 Subject: [PATCH 2/2] [chores] Removed publish command from setup.py --- setup.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/setup.py b/setup.py index 0a9273ee..eba7409e 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,4 @@ #!/usr/bin/env python -import os -import sys - from setuptools import find_packages, setup from openwisp_monitoring import get_version @@ -24,19 +21,6 @@ def get_install_requires(): return requirements -if sys.argv[-1] == 'publish': - # delete any *.pyc, *.pyo and __pycache__ - os.system('find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf') - os.system("python setup.py sdist bdist_wheel") - os.system("twine upload -s dist/*") - os.system("rm -rf dist build") - args = {'version': get_version()} - print("You probably want to also tag the version now:") - print(" git tag -a %(version)s -m 'version %(version)s'" % args) - print(" git push --tags") - sys.exit() - - setup( name='openwisp-monitoring', version=get_version(),