Browse Source

Правки push-update

master
Alexander Demidov 11 years ago
parent
commit
a7948e0b49
  1. 14
      push-update.sh

14
push-update.sh

@ -23,16 +23,18 @@ fi
VERSION_PREVIOUS=`sed -n '4,4p' CHANGELOG.md | cut -d "(" -f1`
if [ `git rev-parse ${VERSION_PREVIOUS}` != `git rev-parse HEAD` ]
then
VERSION=`echo ${VERSION_PREVIOUS} | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{if(length($NF+1)>length($NF))$(NF-1)++; $NF=sprintf("%0*d", length($NF), ($NF+1)%(10^length($NF))); print}`
gitchangelog > CHANGELOG.md &&
git add CHANGELOG.md &&
git commit -m "Update CHANGELOG.md on ${VERSION}" &&
VERSION=`echo ${VERSION_PREVIOUS} | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{if(length($NF+1)>length($NF))$(NF-1)++; $NF=sprintf("%0*d", length($NF), ($NF+1)%(10^length($NF))); print}'`
git tag $VERSION &&
git push --tags
gitchangelog > CHANGELOG.md &&
(git add CHANGELOG.md > /dev/null &&
git commit -m 'Update CHANGELOG.md' > /dev/null &&
git push --tags --porcelain > /dev/null) ||
(echo -e "Cannot push released tag into remote repository\n" &&
exit 1)
else
VERSION=$VERSION_PREVIOUS
fi
git push > /dev/null || exit 1
git push --porcelain > /dev/null || exit 1
MESSAGE="Update ${PATH_LIB} on ${VERSION}"
CURRENT_DIR=`pwd`

Loading…
Cancel
Save