diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml new file mode 100644 index 0000000..27b567a --- /dev/null +++ b/.github/workflows/publish-to-pypi.yml @@ -0,0 +1,50 @@ +name: Publish Python package to PyPI / Test PyPI + +on: + push: + branches: + - '**' + workflow_dispatch: + +jobs: + build-and-publish: + runs-on: ubuntu-latest + + name: Build a Python package and upload it to PyPI / Test PyPI + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: 3.8 + + - name: Install pipenv + run: | + python -m pip install --upgrade pip pipenv + python --version; python -m pip --version; pipenv --version + - id: cache-pipenv + uses: actions/cache@v1 + with: + path: ~/.local/share/virtualenvs + key: ${{ runner.os }}-3.8-pipenv-${{ hashFiles('**/Pipfile.lock') }} + - name: Setup project with pipenv + if: steps.cache-pipenv.outputs.cache-hit != 'true' + run: | + pipenv install --dev + + - name: Build a Python package + run: | + pipenv run build + + - name: Publish the Python package to Test PyPI + uses: pypa/gh-action-pypi-publish@v1.4.2 + with: + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + skip_existing: true + + - name: Publish the Python package to PyPI + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@v1.4.2 + with: + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/smartmeter_datacollector/__version__.py b/smartmeter_datacollector/__version__.py index a97202c..f2a4d60 100644 --- a/smartmeter_datacollector/__version__.py +++ b/smartmeter_datacollector/__version__.py @@ -5,4 +5,4 @@ # SPDX-License-Identifier: GPL-2.0-only # See LICENSES/README.md for more information. # -__version__ = "0.2.0" +__version__ = "0.2.1"