Created
January 28, 2016 13:18
-
-
Save hamsterbacke23/1168cd9fb762a6970491 to your computer and use it in GitHub Desktop.
updateMain.sh
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
#/bin/bash | |
# how many tags back will we search | |
tagCount=$1 | |
if [ -z "$1" ] | |
then | |
tagCount=2 | |
fi | |
previousAndCurrentGitTag=$(git for-each-ref --format="%(refname:short)" refs/tags | tac | sed $(echo $tagCount)q | sed 's/[()]//g' | sed s/,[^,]*$//) | |
previousGitTag=$(echo $previousAndCurrentGitTag | cut -f $tagCount -d ' ') | |
currentGitTag=$(echo $previousAndCurrentGitTag | cut -f 1 -d ' ') | |
echo $previousGitTag | |
echo 'to' | |
echo $currentGitTag | |
cd /srv/www/dir && git pull && grunt deploy --tagstart=$previousGitTag --tagend=$currentGitTag | |
cd - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment