OsmAnd/build-scripts/daily_build.sh

51 lines
1.1 KiB
Bash
Raw Normal View History

2011-01-23 12:45:18 +01:00
#!/bin/sh
DIRECTORY=$(cd `dirname $0` && pwd)
## VARIABLES ###
LOG_DIR="$DIRECTORY"/logs
DATE=$(date +%d-%m-%y)
2011-10-07 01:32:52 +02:00
CLOG_FILE="$LOG_DIR/${DATE}.log"
LOG_FILE="$LOG_DIR/tmp.log"
2011-01-23 12:45:18 +01:00
2011-10-07 01:32:52 +02:00
mkdir -p $LOG_DIR
echo > $LOG_FILE
touch $CLOG_FILE
2011-01-23 12:45:18 +01:00
2011-10-11 22:14:55 +02:00
cd "${DIRECTORY}"
2011-10-11 21:38:51 +02:00
git pull --rebase 2>&1 >>$LOG_FILE
2011-01-23 12:45:18 +01:00
# 1. Update git directory
2011-10-07 01:32:52 +02:00
"${DIRECTORY}/update_git.sh" >>$LOG_FILE 2>&1
2011-01-23 12:45:18 +01:00
# 2. Go through branches and generates builds
2011-10-07 01:32:52 +02:00
"${DIRECTORY}/build_branches.sh" >>$LOG_FILE 2>&1
2011-10-11 21:38:51 +02:00
# exit if nothing was changed
2011-10-11 21:46:41 +02:00
if [ $? == 0 ]; then
2011-10-11 22:17:46 +02:00
exit 0
2011-10-11 21:38:51 +02:00
fi
2011-01-23 12:45:18 +01:00
2011-01-23 13:28:17 +01:00
# 3. upload to ftp server
#"${DIRECTORY}/upload_ftp.sh" 2>&1 >>$LOG_FILE
# 3. upload to ftp server
2011-10-07 01:32:52 +02:00
"${DIRECTORY}/copyto_dir.sh" >>$LOG_FILE 2>&1
2011-01-23 12:45:18 +01:00
# 4. Synchronize github with googlecode mercurial
2011-10-07 01:32:52 +02:00
"${DIRECTORY}/sync_git_google.sh" >>$LOG_FILE 2>&1
2011-01-23 12:45:18 +01:00
2011-08-29 03:13:59 +02:00
# 5. update site files
2011-10-07 01:32:52 +02:00
"${DIRECTORY}/update_site.sh" >>$LOG_FILE 2>&1
cat $LOG_FILE >> $CLOG_FILE
BUILD=`ls *.fixed *.failed 2> /dev/null | wc -l`
2011-10-07 01:32:52 +02:00
if [ ! $BUILD -eq 0 ]; then
# if some status change, print out complete log
echo "Builds status changed"
echo "-------------"
echo `ls *.fixed *.failed`
echo "-------------"
echo "Complete log file:"
2011-10-07 01:32:52 +02:00
echo "-------------"
cat $LOG_FILE
fi