Skip to content

Commit

Permalink
Merge pull request #6 from anx-aster/master
Browse files Browse the repository at this point in the history
Added workflow to publish package on PyPi
  • Loading branch information
nezhar authored Oct 9, 2020
2 parents 1b72f23 + 39abc97 commit 86539f5
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 8 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 0 additions & 3 deletions anexia_monitoring/__version__.py

This file was deleted.

6 changes: 1 addition & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 86539f5

Please sign in to comment.