From 66822b52e00d8fa0ac55001636beb76cae36ae1a Mon Sep 17 00:00:00 2001 From: scivision Date: Sun, 28 Jan 2024 22:43:02 -0500 Subject: [PATCH] add publish workflow --- .github/workflows/publish-python-package.yml | 34 ++++++++++++++++++++ pyproject.toml | 7 ++-- src/findssh/__init__.py | 2 ++ 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/publish-python-package.yml diff --git a/.github/workflows/publish-python-package.yml b/.github/workflows/publish-python-package.yml new file mode 100644 index 0000000..6d2efe5 --- /dev/null +++ b/.github/workflows/publish-python-package.yml @@ -0,0 +1,34 @@ +# https://docs.pypi.org/trusted-publishers/using-a-publisher/ + +name: publish + +on: + release: + types: [published] + +jobs: + release: + + runs-on: ubuntu-latest + + environment: release + + permissions: + id-token: write + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Install builder + run: pip install build + + - name: Build package + run: python -m build + + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/pyproject.toml b/pyproject.toml index b4bf1c0..f087530 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,6 @@ build-backend = "setuptools.build_meta" [project] name = "findssh" -version = "2.0.0" description = "find open servers on IPv4 subnet such as SSH" keywords = ["port-scan", "ssh"] classifiers = [ @@ -24,15 +23,19 @@ classifiers = [ "Topic :: System :: Networking", "Topic :: Utilities" ] -dynamic = ["readme"] +dynamic = ["readme", "version"] requires-python = ">=3.9" +[project.scripts] +findssh = "findssh.__main__:main" + [project.optional-dependencies] tests = ["pytest"] lint = ["flake8", "flake8-bugbear", "flake8-builtins", "flake8-blind-except", "mypy"] [tool.setuptools.dynamic] readme = {file = ["README.md"], content-type = "text/markdown"} +version = {attr = "findssh.__version__"} [tool.black] line-length = 90 diff --git a/src/findssh/__init__.py b/src/findssh/__init__.py index 22ea06a..1f43ac4 100644 --- a/src/findssh/__init__.py +++ b/src/findssh/__init__.py @@ -6,6 +6,8 @@ __all__ = ["get_hosts", "address2net", "get_lan_ip"] +__version__ = "2.0.1" + def get_lan_ip() -> ipaddress.IPv4Address | ipaddress.IPv6Address: """