diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml new file mode 100644 index 000000000..97ff04440 --- /dev/null +++ b/.github/workflows/pypi-release.yml @@ -0,0 +1,33 @@ +name: Publish to PyPI +on: + push: + tags: + - 'v*' + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.11 + + - name: Install Poetry + run: pip install poetry + + - name: Authenticate with PyPI + env: + POETRY_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + run: | + poetry config pypi-token.pypi $POETRY_PYPI_TOKEN + + - name: Build and publish + run: | + cd udf/agent/py + poetry build + poetry publish --no-interaction diff --git a/.gitignore b/.gitignore index d11df6cc0..4150e5304 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,8 @@ kapacitor*.rpm kapacitor*.deb kapacitor*.tar kapacitor*.zip +kapacitor*.tar.gz +kapacitor*.whl *.pyc *.test /test-logs diff --git a/udf/agent/py/kapacitor/udf/__init__.py b/udf/agent/py/kapacitor/udf/__init__.py index d5e775eb2..e69de29bb 100644 --- a/udf/agent/py/kapacitor/udf/__init__.py +++ b/udf/agent/py/kapacitor/udf/__init__.py @@ -1 +0,0 @@ -VERSION = "" diff --git a/udf/agent/py/pyproject.toml b/udf/agent/py/pyproject.toml new file mode 100644 index 000000000..3d2ea1e3e --- /dev/null +++ b/udf/agent/py/pyproject.toml @@ -0,0 +1,19 @@ +[tool.poetry] +name = "kapacitor_udf" +version = "1.6.6" +description = "Kapacitor UDF Agent library" +authors = ["InfluxDB "] +maintainers = ["InfluxDB "] +homepage = "github.com/influxdata/kapacitor" +license = "MIT" +packages = [ + { include = "kapacitor" }, +] + +[tool.poetry.dependencies] +python = "^3.8" +protobuf = "3.18.3" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/udf/agent/py/setup.py b/udf/agent/py/setup.py deleted file mode 100644 index b2adeba71..000000000 --- a/udf/agent/py/setup.py +++ /dev/null @@ -1,23 +0,0 @@ -from setuptools import setup -from os import path - -import sys -setup_dir = path.dirname(__file__) -sys.path.insert(0, setup_dir) - -from kapacitor.udf import VERSION - -setup(name='kapacitor_udf', - version=VERSION, - packages=[ - 'kapacitor', - 'kapacitor.udf', - ], - install_requires=[ - "protobuf==3.18.3", - ], - maintainer_email="support@influxdb.com", - license="MIT", - url="github.com/influxdata/kapacitor", - description="Kapacitor UDF Agent library", -)