-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
2 changed files
with
53 additions
and
0 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,6 @@ | ||
[bumpversion] | ||
current_version = 0.1.0 | ||
commit = True | ||
tag = True | ||
|
||
[bumpversion:file:just_psf/__init__.py] |
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,47 @@ | ||
# check parameters | ||
if [ "$#" -ne 1 ]; then | ||
>&2 echo "Illegal number of parameters" | ||
>&2 echo "usage: ./release_it.sh [major|minor|patch]" | ||
exit 1 | ||
fi | ||
|
||
|
||
# get variables | ||
MAIN_BRANCH="main" | ||
RELEASE_PART=$1 | ||
CURRENT_BRANCH=$(git branch --show-current) | ||
INFO=$(bump2version --list --dry-run "$RELEASE_PART") | ||
if [ "$?" -ne 0 ]; then | ||
>&2 echo "Error while running bump2version, exiting" | ||
exit 1 | ||
fi | ||
|
||
CURRENT_VERSION=$(echo "$INFO" | grep "current_version" | sed -r s,"^.*=",,) | ||
NEW_VERSION=$(echo "$INFO" | grep "new_version" | sed -r s,"^.*=",,) | ||
|
||
# ask | ||
while true; do | ||
read -p "Do you wish to upgrade from $CURRENT_VERSION to $NEW_VERSION? [y/n] " yn | ||
case $yn in | ||
[Yy]* ) break;; | ||
[Nn]* ) exit 0;; | ||
* ) echo "Please answer yes or no.";; | ||
esac | ||
done | ||
|
||
|
||
# go to $MAIN_BRANCH | ||
if [[ $CURRENT_BRANCH != "$MAIN_BRANCH" ]]; then | ||
git checkout master | ||
fi | ||
|
||
git pull | ||
|
||
# bump version | ||
bump2version "$RELEASE_PART" --verbose | ||
git push --follow-tags origin $MAIN_BRANCH | ||
|
||
# switch back to current branch | ||
if [[ $CURRENT_BRANCH != "$MAIN_BRANCH" ]]; then | ||
git checkout "$CURRENT_BRANCH" | ||
fi |