# Be sure to be on 'develop' branch
git checkout develop

# Pull and push all commits
git pull
git push

# Start a new release or hotfix
git-flow release start gitools-2.0.0
git-flow hotfix start gitools-2.0.0

# Update pom.xml version
# The following command only prints to display
# Check that you are going to update only the correct versions:
find . -name pom.xml | awk '{ system("sed 0,/2.0.0/s//2.0.1/ "$0)}' | grep -A2 -B3 2.0.1

# The following command will apply the changes
# Update all like this:
find . -name pom.xml | awk '{ system("sed -i 0,/2.0.0/s//2.0.1/ "$0)}'

# Compile and package 
mvn clean install assembly:assembly

# Test new release
cd target
unzip gitools-2.0.1-bin.zip
gitools-2.0.0/bin/gitools
cd ..

# Deploy ZIP file
scp target/gitools-2.0.1-bin.zip bgadmin@ankara:/usr/local/gitools/www/downloads/

# Deploy Webstart
# change back to the gitools root folder
./webstart-deploy.sh 2.0.1

# Update this file on the server:
/usr/local/gitools/www/downloads/latest.txt

# Commit the changes
git commit -a -m "Set version to 2.0.1"

# Finish the release or hotfix
git flow release finish gitools-2.0.1
git flow hotfix finish gitools-2.0.1

# Check that you are on develop branch
git checkout develop 

# Update pom.xml versions to new SNAPSHOT version

# Check that you are going to update only the correct versions:
find . -name pom.xml | awk '{ system("sed 0,/2.0.1/s//2.1.0-SNAPSHOT/ "$0)}' | grep -A2 -B3 2.1.0-SNAPSHOT

# Update all like this:
find . -name pom.xml | awk '{ system("sed -i 0,/2.0.0/s//2.1.0-SNAPSHOT/ "$0)}'

# Commit
git commit -a -m "Next iteration version 2.1.0-SNAPSHOT"

# Push develop
git push 
git push origin gitools-2.0.0






