Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Commit

Permalink
Refined release.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
budtmo committed Nov 29, 2016
1 parent 3181c15 commit 3b7219f
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,44 @@
set -e

# How to use
# ./release.sh
# ./release.sh release FIXED_VERSION, e.g. ./release.sh release 1.0.0
# ./release.sh develop SNAPSHOT_VERSION, e.g. ./release.sh release 1.1.0-SNAPSHOT

SCRIPT_ACTION=$1
NEW_VERSION=${2?"Usage $0 release|develop version"}
if [ -z "$1" ]; then
read -p "Environment (release|develop) : " ENVIRONMENT
else
ENVIRONMENT=$1
fi

if [ -z "$2" ]; then
read -p "Application version: " VERSION
else
VERSION=$2
fi

release_version()
{
# release
mvn scm:check-local-modification versions:set -DnewVersion=${NEW_VERSION} scm:add -Dincludes="**/pom.xml" scm:checkin -Dmessage="Release $NEW_VERSION"
mvn scm:check-local-modification versions:set -DnewVersion=${VERSION} scm:add -Dincludes="**/pom.xml" scm:checkin -Dmessage="Release $VERSION"

mvn scm:tag
}

develop_version()
{
# next development version, since it only updates the pom.xml, we skip the Travis build
mvn versions:set -DnewVersion=${NEW_VERSION} scm:add -Dincludes="**/pom.xml" scm:checkin -Dmessage="Develop $NEW_VERSION"
mvn versions:set -DnewVersion=${VERSION} scm:add -Dincludes="**/pom.xml" scm:checkin -Dmessage="Develop $VERSION"
}

case ${SCRIPT_ACTION} in
case ${ENVIRONMENT} in
release)
release_version
;;
develop)
develop_version
;;
esac
*)
echo "Invalid environment! Valid options: release, develop"
;;
esac

0 comments on commit 3b7219f

Please sign in to comment.