From 13ed9471b3be924f4ace0dbba2ca27e9dcbd3ce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Feh=C3=A9r?= Date: Sun, 10 Jan 2021 16:34:51 +0100 Subject: [PATCH] Add a GitHub action to push releases to PyPI (#98) * Add a GitHub action to push releases to PyPI * setup.py adjustments to fix PyPI push * setup.py: fix Python 2.7 travis build --- .github/workflows/publish-release.yml | 26 ++++++++++++++++++++++++++ .gitignore | 1 + setup.py | 21 +++++++-------------- 3 files changed, 34 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/publish-release.yml diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 0000000..3fd7f96 --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,26 @@ +name: Publish Release +on: + push: + tags: + - "[0-9]+.[0-9]+.[0-9]+" +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.8" + - name: Prepare Env + run: | + python -m pip install --upgrade pip + pip install setuptools wheel + - name: Build + run: python setup.py sdist bdist_wheel + - name: Publish + uses: pypa/gh-action-pypi-publish@v1.4.1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.gitignore b/.gitignore index 5c4405b..f5ffc2e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ lib/* src/* !.gitignore !.gitmodules +!.github diff --git a/setup.py b/setup.py index 49ff03d..7c21e5b 100644 --- a/setup.py +++ b/setup.py @@ -1,21 +1,13 @@ -''' - Flask-SeaSurf - ------------- - - An updated cross-site forgery protection extension for Flask. - - Links - ````` - - * `documentation `_ -''' import os from setuptools import setup -module_path = os.path.join(os.path.dirname(__file__), 'flask_seasurf.py') +this_directory = os.path.dirname(__file__) +module_path = os.path.join(this_directory, 'flask_seasurf.py') version_line = [line for line in open(module_path) if line.startswith('__version_info__')][0] +with open(os.path.join(this_directory, 'README.markdown')) as f: + long_description = f.read() __version__ = '.'.join(eval(version_line.split('__version_info__ = ')[-1])) @@ -27,7 +19,8 @@ author='Max Countryman', author_email='maxc@me.com', description='An updated CSRF extension for Flask.', - long_description=__doc__, + long_description=long_description, + long_description_content_type='text/markdown', py_modules=['flask_seasurf'], test_suite='test_seasurf', zip_safe=False, @@ -40,7 +33,7 @@ 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python', - 'Programming Language :: Python 3' + 'Programming Language :: Python :: 3', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', 'Topic :: Software Development :: Libraries :: Python Modules' ]