Skip to content

Commit

Permalink
Merge pull request #1 from netboxlabs/feat/ENG-1445_pypi_release
Browse files Browse the repository at this point in the history
ENG-1445 pypi publishing
  • Loading branch information
natm authored Oct 31, 2023
2 parents d17ad21 + 048976d commit aa0c49a
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 3 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/pub-pypi.yml
Original file line number Diff line number Diff line change
@@ -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 }}
1 change: 1 addition & 0 deletions netbox_floorplan/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.3.0"
31 changes: 28 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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="[email protected]",
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(),
Expand Down

0 comments on commit aa0c49a

Please sign in to comment.