diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml new file mode 100644 index 0000000..895455c --- /dev/null +++ b/.github/workflows/publish-to-pypi.yml @@ -0,0 +1,29 @@ +name: Release to PyPI + +on: + release: + types: [released] + +jobs: + release: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install Tools + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Package and Upload + env: + VERSION: ${{ github.event.release.tag_name }} + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_APIKEY }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* \ No newline at end of file diff --git a/setup.py b/setup.py index bcccd94..9a0c0ee 100644 --- a/setup.py +++ b/setup.py @@ -7,6 +7,7 @@ """ # To use a consistent encoding +import os from codecs import open from os import path @@ -15,7 +16,7 @@ here = path.abspath(path.dirname(__file__)) -VERSION = '0.3.0' +VERSION = os.getenv('VERSION') # Get the long description from the README file with open(path.join(here, 'README.md'), encoding='utf-8') as f: