Skip to content

Commit 05cc663

Browse files
committed
Merge pull request #657 from bserdar/release-upstream
Release script knows about upstream
2 parents 4a9164c + 2640386 commit 05cc663

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

etc/release.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ RELEASE_VERSION=$1
66
DEVEL_VERSION=$2
77

88
if [ $1"x" == "x" ] || [ $2"x" == "x" ]; then
9-
echo "Usage: ./release.sh <release version> <new snapshot version>"
10-
echo "Example: ./release 1.1.0 1.2.0-SNAPSHOT"
9+
echo "Usage: ./release.sh <release version> <new snapshot version> [upstream repo]"
10+
echo "Example: ./release 1.1.0 1.2.0-SNAPSHOT origin"
1111
exit 1
1212
fi
1313

14+
UPSTREAM=${3-origin}
15+
1416
# prepare and verify state
1517
git fetch --all
1618
rm -rf ~/.m2/repository/com/redhat/lightblue/
@@ -24,12 +26,12 @@ if [ $BRANCH != "master" ]; then
2426
fi
2527
fi
2628

27-
# check that local branch is equal to upstream master (assumes remote of origin)
28-
MERGE_BASE=`git merge-base HEAD origin/master`
29+
# check that local branch is equal to upstream master
30+
MERGE_BASE=`git merge-base HEAD ${UPSTREAM}/master`
2931
HEAD_HASH=`git rev-parse HEAD`
3032

3133
if [ $MERGE_BASE != $HEAD_HASH ]; then
32-
echo "Local branch is not in sync with origin/master. Fix and run this script again."
34+
echo "Local branch is not in sync with ${UPSTREAM}/master. Fix and run this script again."
3335
exit 1
3436
fi
3537

@@ -45,7 +47,7 @@ mvn release:prepare -P release \
4547
-Dtag=V${RELEASE_VERSION} || exit
4648

4749
# push prepared changes (doing separate just to have control)
48-
git push origin master --tags
50+
git push ${UPSTREAM} master --tags
4951

5052
# perform release
5153
mvn release:perform -P release || exit
@@ -54,7 +56,7 @@ mvn release:perform -P release || exit
5456
mvn versions:use-latest-snapshots versions:update-properties -Dincludes=*lightblue* -DallowSnapshots=true
5557
git add pom.xml **/pom.xml
5658
git commit -m "Updated to latest snapshot dependencies"
57-
git push origin master
59+
git push ${UPSTREAM} master
5860

5961
# deploy updated snapshots
6062
mvn clean deploy

0 commit comments

Comments
 (0)