ISIS-1465: enhancing interim-release.sh to automatically cleanrremote branches and push new branch (and tag)
Project: http://git-wip-us.apache.org/repos/asf/isis/repo Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/8e6baa27 Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/8e6baa27 Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/8e6baa27 Branch: refs/heads/master Commit: 8e6baa275e21ab2e5f4ff9ac66d34cf2469c843c Parents: b2f0226 Author: Dan Haywood <[email protected]> Authored: Fri Sep 9 00:15:31 2016 +0200 Committer: Dan Haywood <[email protected]> Committed: Fri Sep 9 00:32:20 2016 +0200 ---------------------------------------------------------------------- interim-release.sh | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/isis/blob/8e6baa27/interim-release.sh ---------------------------------------------------------------------- diff --git a/interim-release.sh b/interim-release.sh index ea2231b..34dacb8 100644 --- a/interim-release.sh +++ b/interim-release.sh @@ -1,8 +1,10 @@ +#!/bin/bash VERSION_BASE=$1 +REMOTE=$2 -if [ ! "$VERSION_BASE" ]; then - echo "usage: $(basename $0) [base version]" - echo " eg: $(basename $0) 1.13.0" +if [ -z "$VERSION_BASE" -o -z "$REMOTE" ]; then + echo "usage: $(basename $0) [base version] [remote]" + echo " eg: $(basename $0) 1.13.0 incodehq" exit 1 fi @@ -12,6 +14,13 @@ VERSION="$VERSION_BASE.$DATE" BRANCH="interim/$VERSION" TAG="isis-$VERSION" +echo "removing any earlier (local) 'interim' branches" +for a in `git branch --list | grep interim` +do + git branch -D $a +done + +echo "checking out new branch $BRANCH" git checkout -b "$BRANCH" echo "updating version in all pom.xml files..." @@ -24,3 +33,16 @@ git commit -am "bumping to $VERSION" echo "tagging" git tag $TAG + +echo "removing any earlier remote branches" +for a in `git ls-remote --heads $REMOTE | sed 's?.*refs/heads/??' | grep interim` +do + git push $REMOTE --delete $a +done + +echo "pushing tag" +git push $REMOTE $TAG + +echo "pushing branch" +git push $REMOTE $BRANCH +
