#!/bin/bash # Release SNAPSHOT version if [ "${SNAPSHOT_MVN_REPO}" = "" ]; then echo "\"SNAPSHOT_MVN_REPO\" environment variable should be setup before execution" exit -1 fi VERSION=$(cat testable-parent/pom.xml | grep '' | sed -e 's/^.*>\([^<]*\)<.*$/\1/g') MAJOR_VERSION=$(echo $VERSION | sed 's/^\(.*\)\.[0-9]\{1,\}.*/\1/g') declare -i MINOR_VERSION=$(echo $VERSION | sed 's/^.*\.\([0-9]\{1,\}\)/\1/g') MINOR_VERSION=$MINOR_VERSION+1 SNAPSHOT="${MAJOR_VERSION}.${MINOR_VERSION}-SNAPSHOT" echo "Current version: ${VERSION}" echo "Next snapshot version: ${SNAPSHOT}" read -p "Confirm (Y/N) ? " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1 sed -i '' '/<\/profiles>/,$d' testable-parent/pom.xml cat << EOF >> testable-parent/pom.xml snapshot releases http://${SNAPSHOT_MVN_REPO}/mvn/releases snapshots http://${SNAPSHOT_MVN_REPO}/mvn/snapshots EOF for pom in testable-all/pom.xml testable-maven-plugin/pom.xml testable-processor/pom.xml testable-agent/pom.xml testable-core/pom.xml testable-parent/pom.xml; do sed -i '' "s#${VERSION}#${SNAPSHOT}#g" $pom done sed -i '' "s#${VERSION}#${SNAPSHOT}#g" testable-parent/pom.xml echo "Done. Please setup maven configuration for snapshot repository and manually run \"mvn clean deploy -Psnapshot\""