diff --git a/bin/rtags-release.sh b/bin/rtags-release.sh index c3c890bf2..10eada503 100755 --- a/bin/rtags-release.sh +++ b/bin/rtags-release.sh @@ -2,19 +2,26 @@ SCRIPT_PATH=`dirname "$0"`; SCRIPT_PATH=`eval "cd \"$SCRIPT_PATH\" && pwd"` -if [ -n "$RTAGS_RELEASES_REPO" ]; then - if [ ! -d "$RTAGS_RELEASES_REPO" ]; then - git clone git@github.com:Andersbakken/rtags-releases.git "$RTAGS_RELEASES_REPO" - fi - cd "$SCRIPT_PATH/.." - rm -f rtags.tar rtags.tar.gz - $SCRIPT_PATH/git-archive-all $RTAGS_RELEASES_REPO/rtags.tar + +branch_name="$(git symbolic-ref HEAD 2>/dev/null)" || branch_name="(unnamed branch)" # detached HEAD +branch_name=${branch_name##refs/heads/} + +if [ "$branch_name" == "master" ]; then commit=`git show --oneline --no-patch` - cd "$RTAGS_RELEASES_REPO" + cd "$SCRIPT_PATH/.." + rm -f rtags.tar + $SCRIPT_PATH/git-archive-all rtags.tar + rm -rf rtags-release-repo + git new-workdir $PWD rtags-release-repo gh-pages + cd rtags-release-repo + git pull origin gh-pages + rm -f rtags.tar.gz rtags.tar.bz2 rtags.tar + mv ../rtags.tar . gzip --keep rtags.tar bzip2 rtags.tar - git pull git add rtags.tar.gz rtags.tar.bz2 git commit -m "Release for $commit" - git push & + git push origin gh-pages + cd .. + rm -rf rtags-release-repo fi