Merge branch 'patch-1' into 'master'
[xonotic/xonotic.git] / misc / infrastructure / xonotic-release-build.cron
1 #!/bin/sh
2
3 # is being run as cronjob, better set PATH
4 export PATH=/home/xonotic-build/bin:/usr/local/bin:/usr/bin:/bin:/usr/games
5
6 mepwd=$PWD
7 me=$0
8 if ! lockfile-create "$me"; then
9         exit 1
10 fi
11 lockfile-touch "$me" & lockpid=$!
12 trap 'kill $lockpid || true; cd "$mepwd"; lockfile-remove "$me"' EXIT
13 trap 'exit 1' INT TERM
14
15 set -ex
16 export HOSTS_THAT_ARE_MYSELF="xonotic-build-win32 xonotic-build-win64"
17 export HOSTS_THAT_ARE_DISABLED=""
18 ssh xonotic-beta '
19         cd autobuild/;
20         s0=`date -d "now - 7 days - 12 hours" +%s`;
21         s00=`date -d "now - 60 days - 12 hours" +%s`;
22         for X in *; do
23                 [ -f "$X" ] || continue;
24                 d=${X#Xonotic-};
25                 d=${d%%[_-.]*};
26                 [ x"$d" != x"latest" ] || continue;
27                 w=`date -d $d +%w`;
28                 s=`date -d $d +%s`;
29                 if [ "$w" -ne 0 -a "$s" -lt "$s0" -o "$s" -lt "$s00" ]; then
30                         rm -f "$X";
31                 fi;
32         done
33 '
34 cd ~/xonotic-release-build
35 ./all clean --reclone
36 ./all each git checkout HEAD^0
37 # add all feature branches we want
38
39 # map branches that we include:
40 #   winners in the poll for upcoming CTF maps
41 #   maps near completion
42
43 for b in \
44         origin/fruitiex/runningmanctf \
45         origin/mintox/geoplanetary
46 do
47         b=$b ./all each sh -c 'if git rev-parse $b >/dev/null 2>&1; then git merge $b; fi'
48 done
49 ./all update -N
50 d0=`date +%Y%m%d`
51 d=$d0
52 i=1
53 while HEAD http://xonotic:g-23@beta.xonotic.org/autobuild/"Xonotic-$d.zip"; do
54         i=$(($i+1))
55         d="$d0"_"$i"
56 done
57 RELEASETYPE=beta RELEASEDATE=$d ./all release
58 for X in Xonotic-$d*.zip; do
59         ln -snf "$X" "Xonotic-latest${X#Xonotic-$d}"
60 done
61 rsync -vaSHP Xonotic*.zip xonotic-beta:autobuild/
62 ssh xonotic-beta sh update-rsync.sh "$d"
63 echo "Finished a new beta build at http://beta.xonotic.org/autobuild/" | $IRCSPAM
64 cd