From c4aa780d7edb22e7a5daac3b4ce42ca1c3b55ddd Mon Sep 17 00:00:00 2001 From: Harris Tzovanakis Date: Mon, 11 Dec 2023 11:20:54 +0100 Subject: [PATCH] setup: addition of bump2version --- .github/workflows/build-and-release.yml | 92 ++++++++++++++++++++----- inspire_dojson/__init__.py | 2 + setup.cfg | 15 ++++ setup.py | 15 ++-- 4 files changed, 96 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 4008a4ca..32a36efd 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -8,31 +8,28 @@ on: jobs: test: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: - matrix: + matrix: include: - python: python3 pip: pip3 - - python: python2 - pip: pip steps: - name: Checkout uses: actions/checkout@v2 with: - python-version: ${{ matrix.python-version }} fetch-depth: 0 - - name: Install python dependencies - run: | - ${{ matrix.pip }} install --user --upgrade pip - ${{ matrix.pip }} --no-cache-dir install --user setuptools wheel "urllib3==1.25.11" - ${{ matrix.pip }} --no-cache-dir install --user -e .[tests,docs] + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 - - name: Show python dependencies + - name: Install python dependencies run: | - ${{ matrix.python }} --version - ${{ matrix.pip }} freeze + python -m pip install --upgrade pip + pip --no-cache-dir install --user setuptools wheel "urllib3==1.25.11" + pip --no-cache-dir install --user -e .[tests,docs] - name: Show python dependencies run: | @@ -42,15 +39,76 @@ jobs: run: | ./run-tests.sh + bump: + needs: test + runs-on: ubuntu-latest + steps: + - name: Check out the repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install bump2version + shell: bash + run: | + python -m pip install --upgrade pip + pip install bump2version + + - name: Configure git + shell: bash + run: | + git config user.name github-actions + git config user.email github-actions@github.com + + - name: Bump version + shell: bash + run: | + bump2version patch --tag --verbose + + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} + tags: true + + publish: + needs: bump + if: ${{ github.event_name == 'push' }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.8 + + - name: Install python dependencies + run: | + python -m pip install --upgrade pip + pip --no-cache-dir install setuptools wheel "urllib3==1.25.11" + pip --no-cache-dir install -e .[tests,docs] + + - name: Show python dependencies + run: | + pip freeze + - name: Build package - if: ${{ success() && github.event_name == 'push' && matrix.python-version == '2.7' }} run: | - python setup.py sdist bdist_wheel + mkdir clean-build + python setup.py sdist bdist_wheel --universal --dist-dir ./clean-build - name: Publish package - if: ${{ success() && github.event_name == 'push' && matrix.python-version == '2.7' }} uses: pypa/gh-action-pypi-publish@v1.3.1 with: + verify_metadata: false user: __token__ password: ${{ secrets.pypi_password }} - + packages_dir: clean-build/ diff --git a/inspire_dojson/__init__.py b/inspire_dojson/__init__.py index 85b87278..bb00013d 100644 --- a/inspire_dojson/__init__.py +++ b/inspire_dojson/__init__.py @@ -27,3 +27,5 @@ from . import common # noqa: F401 from .api import marcxml2record, record2marcxml # noqa: F401 from .errors import DoJsonError # noqa: F401 + +__version__ = "63.2.0" diff --git a/setup.cfg b/setup.cfg index 7d6dc7f1..28079ce0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -24,6 +24,21 @@ # Tests # +[bumpversion] +current_version = 63.2.0 +commit = True +tag = True +tag_name = {new_version} + +[bumpversion:file:setup.py] +search = version="{current_version}" +replace = version="{new_version}" + +[bumpversion:file:inspire_dojson/__init__.py] +search = __version__ = "{current_version}" +replace = __version__ = "{new_version}" + + [coverage:run] include = inspire_dojson/*.py diff --git a/setup.py b/setup.py index f7cc85fa..181be886 100644 --- a/setup.py +++ b/setup.py @@ -26,17 +26,14 @@ from setuptools import find_packages, setup - URL = "https://github.com/inspirehep/inspire-dojson" readme = open("README.rst").read() -setup_requires = [ - "autosemver~=0.0,>=0.5.2,<1.0.0", -] install_requires = [ - "Flask>=0.12.3", + 'bump2version~=1.0', + "Flask>=0.12.3, <2.0.0", "IDUtils~=1.0,>=1.0.1", "dojson~=1.0,>=1.3.1", "inspire-schemas~=61.4", @@ -60,9 +57,6 @@ extras_require = { "docs": docs_require, "tests": tests_require, - 'tests:python_version=="2.7"': [ - "unicode-string-literal~=1.0,>=1.1", - ], } extras_require["all"] = [] @@ -90,6 +84,7 @@ tests_require=tests_require, setup_requires=setup_requires, extras_require=extras_require, + version="63.2.0", classifiers=[ "Development Status :: 4 - Beta", "Environment :: Web Environment", @@ -97,10 +92,8 @@ "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: OS Independent", "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.8", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules", ],