xonotic/misc/infrastructure/xonotic-release-build.cron
2022-06-19 22:06:44 +10:00

97 lines
2.4 KiB
Bash
Executable File

#!/bin/sh
if [ -z "$RELEASETYPE" ]; then
export RELEASETYPE=autobuild
#export RELEASETYPE=release
fi
case "$RELEASETYPE" in
autobuild)
RELEASETYPEDIR=
RELEASETYPENAME="$RELEASETYPE"
;;
*)
RELEASETYPEDIR="$RELEASETYPE/"
RELEASETYPENAME="$RELEASETYPE-like build"
;;
esac
# is being run as cronjob, better set PATH
export PATH=/home/xonotic-build/ccache:/home/xonotic-build/bin:/usr/local/bin:/usr/bin:/bin:/usr/games
# TEST: use s2tc, high quality
#export dds_tool=s2tc
# Try crunch.
export CACHEDIR=$HOME/.xonotic-cached-converter-crunch
export dds_tool=crunch
# Build locally.
export HOSTS_THAT_ARE_MYSELF='xonotic-build-linux64 xonotic-build-win32 xonotic-build-win64 xonotic-build-osx'
mepwd=$PWD
me=$0
if rm "$me.not-today" 2>/dev/null; then
echo "No build today (not-today marker removed)!"
exit 0
fi
set -ex
test -z "$RELEASETYPEDIR" && ssh autobuild-release-uploader@beta.xonotic.org '
set -e;
s0=`date -d "now - 7 days - 12 hours" +%s`;
s00=`date -d "now - 60 days - 12 hours" +%s`;
for X in * */*; do
[ -f "$X" ] || continue;
d=${X##*/};
d=${d#Xonotic-};
d=${d#gmqcc-};
d=${d%%[-_.]*};
[ x"$d" != x"latest" ] || continue;
w=`date -d $d +%w`;
s=`date -d $d +%s`;
if [ "$w" -ne 0 -a "$s" -lt "$s0" -o "$s" -lt "$s00" ]; then
rm -f "$X";
fi;
done
'
cd ~/xonotic-release-build
./all clean --reclone
# ./all checkout maint
./all checkout
./all each git checkout HEAD^0
# add all feature branches we want
# map branches that we include:
# winners in the poll for upcoming CTF maps
# maps near completion
#for b in \
# origin/divVerent/selfbuildagain \
#; do
# b=$b ./all each sh -c 'if git rev-parse $b >/dev/null 2>&1; then git merge $b; fi'
#done
./all update -N
d0=`date +%Y%m%d`
d=$d0
i=1
while HEAD -C xonotic:g-23 http://beta.xonotic.org/autobuild/"$RELEASETYPEDIR""Xonotic-$d.zip"; do
i=$(($i+1))
d="$d0"_"$i"
done
RELEASEDATE=$d ./all release
sha512sum Xonotic-$d*.zip > Xonotic-$d.sha512
for X in Xonotic-$d*.zip; do
ln -snf "$X" "Xonotic-latest${X#Xonotic-$d}"
done
sha512sum Xonotic-latest*.zip > Xonotic-latest.sha512
rsync -vaSHP Xonotic*.zip Xonotic*.sha512 autobuild-release-uploader@beta.xonotic.org:"$RELEASETYPEDIR"
if [ -z "$RELEASETYPEDIR" ]; then
ssh autobuild-release-uploader@beta.xonotic.org sh ../../update-rsync.sh "$d"
fi
echo "Finished a new $RELEASETYPENAME at http://beta.xonotic.org/autobuild/$RELEASETYPEDIR" | $IRCSPAM
cd