This repository has been archived by the owner on May 5, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/bash | ||
|
||
# check if everything is committed | ||
CLEAN=`git status -s` | ||
if [ ! -z "$CLEAN" ] | ||
then | ||
echo "Working directory not clean. Please commit all changes before tagging" | ||
echo "Aborting." | ||
exit -1 | ||
fi | ||
|
||
echo "Fetching origin..." | ||
git fetch origin > /dev/null | ||
|
||
# check if current branch is master | ||
BRANCH=`git branch | grep "^*" | cut -d " " -f 2` | ||
if [ "$BRANCH" != "master" ] | ||
then | ||
echo "Current branch is $BRANCH. Must be master." | ||
echo "Aborting." | ||
exit -1 | ||
fi | ||
|
||
# check if master == origin/master | ||
MASTER_COMMIT=`git show --format="%H" master` | ||
ORIGINMASTER_COMMIT=`git show --format="%H" origin/master` | ||
|
||
if [ "$MASTER_COMMIT" != "$ORIGINMASTER_COMMIT" ] | ||
then | ||
echo "Local master is not up to date. " | ||
echo "Aborting." | ||
exit -1 | ||
fi | ||
|
||
# check if tag to create has already been created | ||
VERSION=`mvn validate | grep "Building elasticsearch-timefacets-plugin" | cut -d " " -f 4` | ||
EXISTS=`git tag | grep $VERSION` | ||
|
||
if [ "$VERSION" == "$EXISTS" ] | ||
then | ||
echo "Revision $VERSION already tagged." | ||
echo "Aborting." | ||
exit -1 | ||
fi | ||
|
||
# check if VERSION is in head of CHANGES.txt | ||
REV_NOTE=`grep "[0-9/]\{10\} $VERSION" CHANGES.txt` | ||
if [ -z "$REV_NOTE" ] | ||
then | ||
echo "No notes for revision $VERSION found in CHANGES.txt" | ||
echo "Aborting." | ||
exit -1 | ||
fi | ||
|
||
echo "Creating tag $VERSION..." | ||
git tag -a "$VERSION" -m "Tag release for revision $VERSION" | ||
git push --tags | ||
echo "Done." |