Created
July 24, 2012 12:44
-
-
Save hierynomus/3169745 to your computer and use it in GitHub Desktop.
Deployit release alpha versions
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/sh | |
currentAlphaLine=`grep "version.*alpha" build.gradle` | |
currentAlphaVersion=`echo $currentAlphaLine | cut -d \' -f 2` | |
newAlphaVersion=${currentAlphaVersion%-*}-$((${currentAlphaVersion##*-} + 1)) | |
if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then | |
echo "Repository is dirty, please commit first" | |
exit -1 | |
fi | |
if [ -f build.gradle.old ]; then | |
echo "Old build.gradle.old detected, please check whether you were in the middle of a previous alpha release before trying again." | |
exit -1 | |
fi | |
git pull --rebase | |
if [ ! $? -eq 0 ]; then | |
echo "Rebase failed, please fix and try again." | |
exit -1 | |
fi | |
sed -E -i.old -e "s/\/\/[[:space:]]*version/ version/" -e "s/${currentAlphaVersion}/${newAlphaVersion}/" -e "s/[[:space:]]*(version.*SNAPSHOT)/\/\/ \1/" build.gradle | |
gradle clean test uploadArchives | |
if [ ! $? -eq 0 ]; then | |
echo "Build failed!" | |
exit -1 | |
fi | |
sed -E -i.old -e "s/\/\/[[:space:]]*version/ version/" -e "s/[[:space:]]*(version.*alpha)/\/\/ \1/" build.gradle | |
git add build.gradle | |
git commit -m "$(basename `pwd`) $newAlphaVersion" | |
rm build.gradle.old |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment