Skip to content

Instantly share code, notes, and snippets.

@leonj1
Created August 30, 2018 03:52
Show Gist options
  • Save leonj1/fab958cef5536de614bfb0d00586111e to your computer and use it in GitHub Desktop.
Save leonj1/fab958cef5536de614bfb0d00586111e to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
TAG=$1
GIT_MERGE_AUTOEDIT=no
export GIT_MERGE_AUTOEDIT
#git checkout develop
git flow release start ${TAG} || true
# using -m makes in non-interactive
git flow release finish -m "release" ${TAG}
# after release the branch is changed to master
if [ -f $(pwd)/pom.xml ]; then
# update master to the expected version/TAG
mvn versions:set -DnewVersion=${TAG}
git commit -am "release ${TAG}"
git push
fi
# push the release tag to github
~/follow_tags.sh
if [ -f $(pwd)/pom.xml ]; then
# run the maven project
mvn clean install
# update develop branch to a new project version
git checkout develop
GIT_SEQUENCE_EDITOR=true git rebase master
SNAPSHOT_VERSION=`~/increment_version.sh -p ${TAG}`-SNAPSHOT
mvn versions:set -DnewVersion=${SNAPSHOT_VERSION}
git commit -am "release ${SNAPSHOT_VERSION}"
git push
fi
echo "***********************************************"
echo "Do not forget to push the docker image!"
echo "***********************************************"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment