diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..6047b61 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,39 @@ +name: Publish package +on: + release: + types: [created] + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.8' + architecture: 'x64' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + + - name: Build source and binary distribution package + run: python setup.py sdist bdist_wheel + env: + PACKAGE_VERSION: ${{ github.ref }} + + - name: Check distribution package + run: twine check dist/* + + - name: Publish distribution package + run: twine upload dist/* + env: + TWINE_REPOSITORY: ${{ secrets.PYPI_REPOSITORY }} + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + TWINE_NON_INTERACTIVE: yes \ No newline at end of file diff --git a/anexia_monitoring/__version__.py b/anexia_monitoring/__version__.py deleted file mode 100644 index 268300d..0000000 --- a/anexia_monitoring/__version__.py +++ /dev/null @@ -1,3 +0,0 @@ -# -*- coding: utf-8 -*- - -__version__ = "1.2.0" diff --git a/setup.py b/setup.py index cfe6374..84d4dd4 100644 --- a/setup.py +++ b/setup.py @@ -44,10 +44,6 @@ with io.open(os.path.join(current_path, 'README.md'), encoding='utf-8') as f: long_description = '\n' + f.read() -# Load the package's __version__.py module as a dictionary. -about = {} -with open(os.path.join(current_path, PACKAGE_PATH, '__version__.py')) as f: - exec(f.read(), about) class PublishCommand(Command): """Support setup.py publish.""" @@ -83,7 +79,7 @@ def run(self): setup( name=NAME, - version=about['__version__'], + version=os.getenv('PACKAGE_VERSION', '0.0.0').replace('refs/tags/', ''), packages=find_packages(), include_package_data=True, license=LICENSE,