From 10b90131bcf951547b9363e8617d8af3c1e1786d Mon Sep 17 00:00:00 2001 From: Ray Luo Date: Sat, 18 Feb 2023 19:39:56 -0800 Subject: [PATCH 1/2] Setup infrastructure for future releases --- .github/workflows/python-package.yml | 35 ++++++++++++++++++++++++++++ setup.py | 8 ++++++- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/python-package.yml 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/setup.py b/setup.py index 18686cc7..2714f830 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', From 51ff1b059436f732b845252636251f6b5fe288f3 Mon Sep 17 00:00:00 2001 From: Ray Luo Date: Sun, 19 Feb 2023 19:42:49 -0800 Subject: [PATCH 2/2] Release 0.4.1 to pin flask upper bound to <2.3 --- flask_session/__init__.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 2714f830..d8064e1a 100644 --- a/setup.py +++ b/setup.py @@ -35,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',