From 37d85aaa7ef032ac4e4d16d7cd851d686cef0106 Mon Sep 17 00:00:00 2001 From: Gabor Feher Date: Fri, 18 Dec 2020 21:58:03 +0100 Subject: [PATCH 1/3] Add a GitHub action to push releases to PyPI --- .github/workflows/publish-release.yml | 26 ++++++++++++++++++++++++++ .gitignore | 1 + 2 files changed, 27 insertions(+) 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 From 8795db72491d5a7cddc0c9eed5fea222ed751343 Mon Sep 17 00:00:00 2001 From: Gabor Feher Date: Fri, 18 Dec 2020 22:02:02 +0100 Subject: [PATCH 2/3] setup.py adjustments to fix PyPI push --- setup.py | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/setup.py b/setup.py index 49ff03d..7c83419 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'), encoding='utf-8') 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' ] From b7910b2397e5f48e730b08775755f7ae02bb914e Mon Sep 17 00:00:00 2001 From: Gabor Feher Date: Sun, 20 Dec 2020 01:19:05 +0100 Subject: [PATCH 3/3] setup.py: fix Python 2.7 travis build --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7c83419..7c21e5b 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ 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'), encoding='utf-8') as f: +with open(os.path.join(this_directory, 'README.markdown')) as f: long_description = f.read() __version__ = '.'.join(eval(version_line.split('__version_info__ = ')[-1]))