Skip to content

Commit

Permalink
Add a GitHub action to push releases to PyPI (#98)
Browse files Browse the repository at this point in the history
* Add a GitHub action to push releases to PyPI

* setup.py adjustments to fix PyPI push

* setup.py: fix Python 2.7 travis build
  • Loading branch information
gaborfeher committed Jan 10, 2021
1 parent 4dedf27 commit 13ed947
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 14 deletions.
26 changes: 26 additions & 0 deletions .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 }}
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -9,3 +9,4 @@ lib/*
src/*
!.gitignore
!.gitmodules
!.github
21 changes: 7 additions & 14 deletions setup.py
@@ -1,21 +1,13 @@
'''
Flask-SeaSurf
-------------
An updated cross-site forgery protection extension for Flask.
Links
`````
* `documentation <http://packages.python.org/Flask-SeaSurf>`_
'''
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]))

Expand All @@ -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,
Expand All @@ -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'
]
Expand Down

0 comments on commit 13ed947

Please sign in to comment.