Update set-version to better detect current version

This commit is contained in:
Paul Campbell 2018-02-28 18:35:09 +00:00
parent 1a38a1220c
commit b5f13e0038

View file

@ -1,15 +1,19 @@
#!/usr/bin/env bash #!/usr/bin/env bash
cd `dirname $0`
PROJECT=`basename $PWD`
if test $# != 1 if test $# != 1
then then
echo "next version missing" echo "next version missing"
exit exit
fi fi
CURRENT=`grep '<version>' pom.xml |head -n 1| sed 's/.*>\(.*\)<.*/\1/'` CURRENT=`grep -C 2 "<artifactId>${PROJECT}</artifactId>" pom.xml | grep '<version>' | sed 's/.*>\(.*\)<.*/\1/'`
NEXT=$1 NEXT=$1
echo Updating version from $CURRENT to $NEXT echo Updating version from $CURRENT to $NEXT
./mvnw versions:set -DnewVersion=$NEXT ./mvnw versions:set -DnewVersion=$NEXT
perl -p -i -e "s,$CURRENT</,$NEXT</," README.md ./mvnw -pl parent versions:set -DnewVersion=$NEXT
perl -p -i -e "s,$CURRENT</,$NEXT</," all/tile.xml README.md