Skip to content

Commit

Permalink
add GitHub workflow to publish to (Test) PyPI
Browse files Browse the repository at this point in the history
  • Loading branch information
Montellese committed Aug 19, 2021
1 parent 6360956 commit a97aadd
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
50 changes: 50 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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/[email protected]
with:
password: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 1 addition & 1 deletion smartmeter_datacollector/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit a97aadd

Please sign in to comment.