Skip to content

Commit

Permalink
bumpversion(s)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilja Orlovs committed Jan 20, 2018
1 parent 6d0833b commit 07bdc5b
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 2 deletions.
67 changes: 67 additions & 0 deletions bin/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash -ex

function require_clean_work_tree () {
# Update the index
git update-index -q --ignore-submodules --refresh
err=0

# Disallow unstaged changes in the working tree
if ! git diff-files --quiet --ignore-submodules --
then
echo >&2 "cannot $1: you have unstaged changes."
git diff-files --name-status -r --ignore-submodules -- >&2
err=1
fi

# Disallow uncommitted changes in the index
if ! git diff-index --cached --quiet HEAD --ignore-submodules --
then
echo >&2 "cannot $1: your index contains uncommitted changes."
git diff-index --cached --name-status -r --ignore-submodules HEAD -- >&2
err=1
fi

if [ $err = 1 ]
then
echo >&2 "Please commit or stash them."
exit 1
fi
}

echo "This script increments build version and merges current master into production"
echo " with an appropriate tag."
echo ""
echo "Pass a name of version number to be incremented ('major', 'minor' or 'patch')"

PROJECT_DIR="$(dirname '${BASH_SOURCE[0]}')/.."
BUMPED_VERSION="$1"

if [ -x "${BUMPED_VERSION}" ]; then
echo >&2 "You must specify what version number to increment"
exit 1
fi

CURRENT_BRANCH=$(git symbolic-ref -q HEAD)
CURRENT_BRANCH=${CURRENT_BRANCH##refs/heads/}

if [ "${CURRENT_BRANCH}" != "master" ]; then
echo >&2 "You must be on 'master' branch."
exit 1
fi

require_clean_work_tree

git checkout production
git merge master --squash

# Execute tests (just in case)
python "${PROJECT_DIR}/setup.py" test

git commit -m "Merging code from 'master'" -m "Squashed commit"

bumpversion --message 'New release on {utcnow}: {new_version}'
git push origin production --tags

git checkout master
git merge production # Update version string(s)
git push
1 change: 1 addition & 0 deletions requirements/develop.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ pytest-cov>=2.5.1
pytest-pep8>=1.0.6
pytest-runner>=3.0
python-coveralls>=2.9.1
bumpversion>=0.5.3

-r production.txt
13 changes: 12 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,15 @@
test=pytest

[metadata]
description-file = README.md
description-file = README.md

[bumpversion]
current_version = 0.0.4
commit = True
tag = True

[bumpversion:file:sqlalchemy_fsm/__init__.py]
search = __version__ = '{ current_version }'
replace = __version__ = '{ new_version }'

[bumpversion:file:setup.py]
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
description='Finite state machine field for sqlalchemy',
author='Peter & Ilja',
author_email='ilja@wise.fish',
version='1.0.0',
version='0.0.4',
url='https://github.com/dagoof/sqlalchemy-fsm',
install_requires=['SQLAlchemy>=1.0.0'],
setup_requires=['pytest-runner'],
Expand Down
2 changes: 2 additions & 0 deletions sqlalchemy_fsm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
can_proceed,
is_current,
)

__version__ = '1.0.0'

0 comments on commit 07bdc5b

Please sign in to comment.