Browse Source

Корректировки push-update

master
Alexander Demidov 11 years ago
parent
commit
121d71d8f9
  1. 7
      CHANGELOG.md
  2. 30
      push-update.sh

7
CHANGELOG.md

@ -1,6 +1,13 @@
Changelog Changelog
========= =========
0.0.03 (2014-01-13)
-------------------
- Корректировки push-update. [Alexander Demidov]
- Правка push-update. [Alexander Demidov]
0.0.01 (2014-01-13) 0.0.01 (2014-01-13)
------------------- -------------------

30
push-update.sh

@ -1,16 +1,23 @@
#!/bin/bash #!/bin/bash
PATH_LIB='/lib/Image' PATH_LIB='/lib/Image'
PROJECTS=( "/var/www/10ballov" "/var/www/predelanet" "/var/www/zelenoemore" "/var/www/d753_common" ) PROJECTS=( "/var/www/10ballov" "/var/www/predelanet" "/var/www/zelenoemore" "/var/www/d753_common" )
if [ ! test -n CHANGELOG.md ]
if [ ! -f "CHANGELOG.md" ]
then then
echo 'CHANGELOG.md not exists or empty.'
echo "CHANGELOG.md not exists\n"
exit 1
fi
test -n "`tail CHANGELOG.md`"
CHANGELOG_EMPTY=`echo $?`
if [ $CHANGELOG_EMPTY == 1 ]
then
echo -e "CHANGELOG.md is empty\n"
exit 1 exit 1
fi fi
git diff-index --quiet HEAD -- git diff-index --quiet HEAD --
REPO_CHANGED=`echo $?` REPO_CHANGED=`echo $?`
if [ $REPO_CHANGED ]
if [ $REPO_CHANGED == 1 ]
then then
echo 'Please commit all changes in repository.'
echo -e "Please commit all changes in repository\n"
exit 1 exit 1
fi fi
VERSION_PREVIOUS=`sed -n '4,4p' CHANGELOG.md | cut -d "(" -f1` VERSION_PREVIOUS=`sed -n '4,4p' CHANGELOG.md | cut -d "(" -f1`
@ -31,33 +38,34 @@ MESSAGE="Update ${PATH_LIB} on ${VERSION}"
CURRENT_DIR=`pwd` CURRENT_DIR=`pwd`
for project in "${PROJECTS[@]}" for project in "${PROJECTS[@]}"
do do
echo "Update lib for ${i}...\n"
echo -e "Update lib for ${i}...\n"
(cd "${project}${PATH_LIB}" && (cd "${project}${PATH_LIB}" &&
git fetch > /dev/null && git fetch > /dev/null &&
git checkout $VERSION > /dev/null) || git checkout $VERSION > /dev/null) ||
(echo "Failed to checkout lib on tag ${VERSION}\n" &&
(echo -e "Failed to checkout lib on tag ${VERSION}\n" &&
exit 1) exit 1)
cd "${project}" cd "${project}"
git diff-index --quiet HEAD "${PATH_LIB#'/'}" git diff-index --quiet HEAD "${PATH_LIB#'/'}"
if [ `echo $?` ]
LIB_NEW_COMMITS=`echo $?`
if [ $LIB_NEW_COMMITS == 1 ]
then then
(git reset > /dev/null (git reset > /dev/null
git add "${PATH_LIB#'/'}" > /dev/null && git add "${PATH_LIB#'/'}" > /dev/null &&
git commit -m $MESSAGE > /dev/null) || git commit -m $MESSAGE > /dev/null) ||
(echo "Failed to update lib for ${project}\n" &&
(echo -e "Failed to update lib for ${project}\n" &&
exit 1) 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) || cd /var/www/d753_10ballov/ && ./merge-from-master.sh > /dev/null) ||
(echo "Failed to update dependency d753 branches... Please resolve that problem by hand\n" &&
(echo -e "Failed to update dependency d753 branches... Please resolve that problem by hand\n" &&
exit 1) exit 1)
fi fi
else else
echo "Already update\n"
echo -e "Already update\n"
fi fi
done done
echo "All operations succeed\n"
echo -e "All operations succeed\n"
exit 0 exit 0
Loading…
Cancel
Save