diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 00000000..ab94d7dd --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,35 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: CI/CD + +on: + push: + pull_request: + branches: [ dev ] + + # This guards against unknown PR until a community member vet it and label it. + types: [ labeled ] + +jobs: + cd: + if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags') || github.ref == 'refs/heads/master') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.9 + uses: actions/setup-python@v3 + with: + python-version: 3.9 + - name: Build a package for release + run: | + python -m pip install build --user + python -m build --sdist --wheel --outdir dist/ . + - name: Publish to TestPyPI + run: echo "Last time I tried, I do not have permission to release it on Test PyPI" + - name: Publish to PyPI + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@v1.4.2 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/flask_session/__init__.py b/flask_session/__init__.py index 96912d12..3e697b02 100644 --- a/flask_session/__init__.py +++ b/flask_session/__init__.py @@ -9,7 +9,7 @@ :license: BSD, see LICENSE for more details. """ -__version__ = '0.4.0' +__version__ = '0.4.1' import os diff --git a/setup.py b/setup.py index 18686cc7..d8064e1a 100644 --- a/setup.py +++ b/setup.py @@ -12,12 +12,18 @@ `_ """ +import re, io from setuptools import setup +# setup.py shall not import main package +__version__ = re.search( + r'__version__\s*=\s*[\'"]([^\'"]*)[\'"]', # It excludes inline comment too + io.open('flask_session/__init__.py', encoding='utf_8_sig').read() + ).group(1) setup( name='Flask-Session', - version='0.4.0', + version=__version__, url='https://github.com/fengsp/flask-session', license='BSD', author='Shipeng Feng', @@ -29,7 +35,7 @@ include_package_data=True, platforms='any', install_requires=[ - 'Flask>=0.8', + 'Flask>=0.8,<2.3', # Flask 2.3 removed app.session_cookie_name 'cachelib' ], test_suite='test_session',