forked from dagoof/sqlalchemy-fsm
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ilja Orlovs
committed
Jan 20, 2018
1 parent
6d0833b
commit 07bdc5b
Showing
5 changed files
with
83 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,5 @@ | |
can_proceed, | ||
is_current, | ||
) | ||
|
||
__version__ = '1.0.0' |