#!/bin/bash ISSUE_ID="" ISSUE_STATE="" SCRIPT_DIR=$(readlink -f $0 | xargs dirname | xargs dirname) VERSION=$(cat $SCRIPT_DIR/trunk/src/version) TRUNK="$SCRIPT_DIR/trunk" RELEASE_BRANCH="$SCRIPT_DIR/tags/release-$VERSION" if [ -d "$RELEASE_BRANCH" ] ; then echo "$RELEASE_BRANCH already exsits" echo exit 1; fi if [ "$ISSUE_ID" = "" ] ; then echo -n "Enter YouTrack Issue: " read ISSUE_ID if [ "$ISSUE_ID" = "" ] ; then printError "YouTrack Issue is not defined" exit; fi fi PROJECT_ID=$(echo "$ISSUE_ID" | sed -r 's/-[0-9]+//') response=$(curl -kI --user svn:postcommit https://youtrack.orange35.com/rest/issue/$ISSUE_ID 2>/dev/null| grep '200 OK'); if [ ! "$response" ]; then echo "YouTrack Issue \"$ISSUE_ID\" is not found" exit 1; fi ISSUE_STATE=$(curl -k --user svn:postcommit https://youtrack.orange35.com/rest/issue/$ISSUE_ID 2>/dev/null| xpath -q -e '//field[@name="State"]/value[1]/text()') if [ "$ISSUE_STATE" == "Closed" ]; then echo "YouTrack Issue \"$ISSUE_ID\" is $ISSUE_STATE" exit 1; fi echo "Issue: $ISSUE_ID ($ISSUE_STATE)"; echo "Release $RELEASE_BRANCH will be created from $TRUNK." echo "Press Enter to continue or Ctrl+C to cancel" read svn up $TRUNK > /dev/null svn up -N "$SCRIPT_DIR/tags" > /dev/null svn cp $TRUNK $RELEASE_BRANCH > /dev/null svn ci $RELEASE_BRANCH -m "created release $VERSION. Issue $ISSUE_ID" > /dev/null svn ps svn:externals "^/tags/release-$VERSION/build/hart.phar latest" tags > /dev/null svn up -N "$SCRIPT_DIR/tags" > /dev/null svn ci "$SCRIPT_DIR/tags" -N -m "updated external tags/latest to tags/release-$VERSION. Issue $ISSUE_ID" > /dev/null echo "release $VERSION successfully created" echo exit 0;