Skip to content

Commit

Permalink
setup: addition of bump2version
Browse files Browse the repository at this point in the history
  • Loading branch information
drjova committed Dec 11, 2023
1 parent f025829 commit c4aa780
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 28 deletions.
92 changes: 75 additions & 17 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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 [email protected]
- 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/[email protected]
with:
verify_metadata: false
user: __token__
password: ${{ secrets.pypi_password }}

packages_dir: clean-build/
2 changes: 2 additions & 0 deletions inspire_dojson/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
15 changes: 15 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 4 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,14 @@

from setuptools import find_packages, setup


URL = "https:/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",
Expand All @@ -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"] = []
Expand Down Expand Up @@ -90,17 +84,16 @@
tests_require=tests_require,
setup_requires=setup_requires,
extras_require=extras_require,
version="63.2.0",
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"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",
],
Expand Down

0 comments on commit c4aa780

Please sign in to comment.