Browse Source

Правки push-update (возможно, завершающие)

master
Alexander Demidov 11 years ago
parent
commit
93abd1671e
  1. 39
      push-update.sh

39
push-update.sh

@ -24,13 +24,14 @@ VERSION_PREVIOUS=`sed -n '4,4p' CHANGELOG.md | cut -d "(" -f1`
if [ `git rev-parse ${VERSION_PREVIOUS}` != `git rev-parse HEAD` ] if [ `git rev-parse ${VERSION_PREVIOUS}` != `git rev-parse HEAD` ]
then 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}'` 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 tag "$VERSION" &&
gitchangelog > CHANGELOG.md && gitchangelog > CHANGELOG.md &&
(git add CHANGELOG.md > /dev/null &&
git commit -m 'Update CHANGELOG.md' > /dev/null &&
git push --tags > /dev/null) ||
(echo -e "Cannot push released tag into remote repository\n" &&
exit 1)
{ git add CHANGELOG.md > /dev/null &&
git commit -m "Update CHANGELOG.md" > /dev/null &&
git tag "$VERSION" &&
git push --tags >/dev/null 2>/dev/null; } ||
{ echo -e "Cannot push released tag into remote repository\n" &&
exit 1; }
else else
VERSION=$VERSION_PREVIOUS VERSION=$VERSION_PREVIOUS
fi fi
@ -41,31 +42,29 @@ CURRENT_DIR=`pwd`
for project in "${PROJECTS[@]}" for project in "${PROJECTS[@]}"
do do
echo -e "Update lib for ${project}...\n" echo -e "Update lib for ${project}...\n"
(cd "${project}${PATH_LIB}" &&
{cd "${project}${PATH_LIB}" &&
git fetch >/dev/null 2>/dev/null && git fetch >/dev/null 2>/dev/null &&
git checkout $VERSION 2>/dev/null) ||
(echo -e "Failed to checkout lib on tag ${VERSION}\n" &&
exit 1)
git checkout $VERSION 2>/dev/null; } ||
{ echo -e "Failed to checkout lib on tag ${VERSION}\n" &&
exit 1; }
cd "${project}" cd "${project}"
LIB_DIR=`echo ${PATH_LIB#'/'}` LIB_DIR=`echo ${PATH_LIB#'/'}`
git diff-index --quiet HEAD "$LIB_DIR" git diff-index --quiet HEAD "$LIB_DIR"
LIB_NEW_COMMITS=`echo $?` LIB_NEW_COMMITS=`echo $?`
if [ $LIB_NEW_COMMITS == 1 ] if [ $LIB_NEW_COMMITS == 1 ]
then then
echo -e "`pwd`\n"
exit 1
(git reset > /dev/null &&
{ git reset > /dev/null &&
git add "$LIB_DIR" > /dev/null && git add "$LIB_DIR" > /dev/null &&
git commit -m $MESSAGE > /dev/null) ||
(echo -e "Failed to update lib for ${project}\n" &&
exit 1)
git commit -m "$MESSAGE" > /dev/null; } ||
{ echo -e "Failed to update lib for ${project}\n" &&
exit 1; }
if [ $project == "/var/www/d753_common" ] if [ $project == "/var/www/d753_common" ]
then then
(git push origin master > /dev/null &&
{ git push origin master > /dev/null &&
cd /var/www/d753/ && ./merge-from-master.sh > /dev/null cd /var/www/d753/ && ./merge-from-master.sh > /dev/null
cd /var/www/d753_10ballov/ && ./merge-from-master.sh > /dev/null) ||
(echo -e "Failed to update dependency d753 branches... Please resolve that problem by hand\n" &&
exit 1)
cd /var/www/d753_10ballov/ && ./merge-from-master.sh > /dev/null; } ||
{ echo -e "Failed to update dependency d753 branches... Please resolve that problem by hand\n" &&
exit 1; }
fi fi
else else
echo -e "Already update\n" echo -e "Already update\n"

Loading…
Cancel
Save