diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..41786e4 --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,44 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Upload Python Package + +on: + release: + types: [published] + workflow_dispatch: + +permissions: + contents: read + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install build + - name: Set version number + run: | + sed -i 's/{{VERSION_PLACEHOLDER}}/'$(echo ${{ github.event.release.tag_name }} | sed 's/^v//')'/g' setup.py sense_energy/__init__.py + - name: Build package + run: python -m build -x + - name: Publish package + uses: pypa/gh-action-pypi-publish@unstable/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..1371ecd --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +async_timeout +orjson +requests +websocket-client +websockets +aiohttp diff --git a/sense_energy/__init__.py b/sense_energy/__init__.py index 4417e2d..679d4ad 100644 --- a/sense_energy/__init__.py +++ b/sense_energy/__init__.py @@ -9,4 +9,4 @@ from .plug_instance import PlugInstance from .sense_link import SenseLink -__version__ = "0.11.1" +__version__ = "{{VERSION_PLACEHOLDER}}" diff --git a/setup.py b/setup.py index 2e7b007..b317d3a 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ with open("README.md", "r") as fh: long_description = fh.read() -version = '0.11.1' +version = '{{VERSION_PLACEHOLDER}}' setup( name = 'sense_energy', packages = ['sense_energy'],