diff --git a/.github/workflows/pub-pypi.yml b/.github/workflows/pub-pypi.yml new file mode 100644 index 0000000..2b57e7c --- /dev/null +++ b/.github/workflows/pub-pypi.yml @@ -0,0 +1,35 @@ +name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI + +on: + release: + types: [published] + +jobs: + build-n-publish: + name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@main + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Install pypa/build + run: >- + python -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: >- + python -m + build + --sdist + --wheel + --outdir dist/ + . + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/netbox_floorplan/version.py b/netbox_floorplan/version.py new file mode 100644 index 0000000..493f741 --- /dev/null +++ b/netbox_floorplan/version.py @@ -0,0 +1 @@ +__version__ = "0.3.0" diff --git a/setup.py b/setup.py index 21a4639..fcedad7 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,37 @@ +import codecs +import os.path + from setuptools import find_packages, setup + +with open("README.md", "r") as fh: + long_description = fh.read() + + +def read(rel_path): + here = os.path.abspath(os.path.dirname(__file__)) + with codecs.open(os.path.join(here, rel_path), 'r') as fp: + return fp.read() + + +def get_version(rel_path): + for line in read(rel_path).splitlines(): + if line.startswith('__version__'): + delim = '"' if '"' in line else "'" + return line.split(delim)[1] + else: + raise RuntimeError("Unable to find version string.") + + setup( - name="netbox_floorplan", - version="0.1.1", + name="netbox-floorplan-plugin", + version=get_version('netbox_floorplan/version.py'), author="Tony Nealon", author_email="tony@worksystems.co.nz", description="Netbox Plugin to support graphical floorplans", - url="https://github.com/tbotnz/netbox_floorplan.git", + long_description=long_description, + long_description_content_type="text/markdown", + url="https://github.com/netboxlabs/netbox-floorplan-plugin.git", license="LGPLv3+", install_requires=[], packages=find_packages(),