Корректировки push-update
This commit is contained in:
@ -1,6 +1,13 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
0.0.03 (2014-01-13)
|
||||
-------------------
|
||||
|
||||
- Корректировки push-update. [Alexander Demidov]
|
||||
|
||||
- Правка push-update. [Alexander Demidov]
|
||||
|
||||
0.0.01 (2014-01-13)
|
||||
-------------------
|
||||
|
||||
|
@ -1,16 +1,23 @@
|
||||
#!/bin/bash
|
||||
PATH_LIB='/lib/Image'
|
||||
PROJECTS=( "/var/www/10ballov" "/var/www/predelanet" "/var/www/zelenoemore" "/var/www/d753_common" )
|
||||
if [ ! test -n CHANGELOG.md ]
|
||||
if [ ! -f "CHANGELOG.md" ]
|
||||
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
|
||||
fi
|
||||
git diff-index --quiet HEAD --
|
||||
REPO_CHANGED=`echo $?`
|
||||
if [ $REPO_CHANGED ]
|
||||
if [ $REPO_CHANGED == 1 ]
|
||||
then
|
||||
echo 'Please commit all changes in repository.'
|
||||
echo -e "Please commit all changes in repository\n"
|
||||
exit 1
|
||||
fi
|
||||
VERSION_PREVIOUS=`sed -n '4,4p' CHANGELOG.md | cut -d "(" -f1`
|
||||
@ -31,33 +38,34 @@ MESSAGE="Update ${PATH_LIB} on ${VERSION}"
|
||||
CURRENT_DIR=`pwd`
|
||||
for project in "${PROJECTS[@]}"
|
||||
do
|
||||
echo "Update lib for ${i}...\n"
|
||||
echo -e "Update lib for ${i}...\n"
|
||||
(cd "${project}${PATH_LIB}" &&
|
||||
git fetch > /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)
|
||||
cd "${project}"
|
||||
git diff-index --quiet HEAD "${PATH_LIB#'/'}"
|
||||
if [ `echo $?` ]
|
||||
LIB_NEW_COMMITS=`echo $?`
|
||||
if [ $LIB_NEW_COMMITS == 1 ]
|
||||
then
|
||||
(git reset > /dev/null
|
||||
git add "${PATH_LIB#'/'}" > /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)
|
||||
if [ $project == "/var/www/d753_common" ]
|
||||
then
|
||||
(git push origin master > /dev/null &&
|
||||
cd /var/www/d753/ && ./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)
|
||||
fi
|
||||
else
|
||||
echo "Already update\n"
|
||||
echo -e "Already update\n"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "All operations succeed\n"
|
||||
echo -e "All operations succeed\n"
|
||||
exit 0
|
Reference in New Issue
Block a user