2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-12-01 14:40:28 +01:00
xash3d-fwgs/travis-upload.sh

36 lines
1.2 KiB
Bash
Raw Normal View History

2016-11-25 06:12:47 +01:00
#!/bin/sh
2016-11-24 07:36:00 +01:00
# Upload travis generated APKs to the Transfer.sh and Yandex.Disk
getDaysSinceRelease()
{
printf %04d $(( ( $(date +'%s') - $(date -ud '2015-04-01' +'%s') )/60/60/24 ))
}
DAYSSINCERELEASE=`getDaysSinceRelease`
COMMITHASH=$(git rev-parse --short HEAD)
#CURRENTBRANCH=$(git rev-parse --abbrev-ref HEAD)
PREFIX=$DAYSSINCERELEASE-$(date +"%H-%M")
POSTFIX=$COMMITHASH
2016-11-25 12:26:49 +01:00
YADISKPATH=`date +%Y/%m/%d`
curl -u $YADISK_USERNAME:$YADISK_PASSWORD -X MKCOL https://webdav.yandex.ru/XashTestVersions/`date +%Y`
curl -u $YADISK_USERNAME:$YADISK_PASSWORD -X MKCOL https://webdav.yandex.ru/XashTestVersions/`date +%Y/%m`/
curl -u $YADISK_USERNAME:$YADISK_PASSWORD -X MKCOL https://webdav.yandex.ru/XashTestVersions/`date +%Y/%m/%d`/
2016-11-24 09:21:13 +01:00
while [ "$1" != "" ]; do
2016-11-24 07:36:00 +01:00
FNAME=$1
FILE_BASE=${FNAME%.*}
FILE_EXT="${FNAME##*.}"
OUTNAME=$PREFIX-$FILE_BASE-$POSTFIX.$FILE_EXT
2016-11-25 06:00:26 +01:00
echo $FNAME: `curl -s --upload-file $FNAME https://transfer.sh/$OUTNAME 2>/dev/null`
curl -T $FNAME -s -u $YADISK_USERNAME:$YADISK_PASSWORD https://webdav.yandex.ru/XashTestVersions/$YADISKPATH/$OUTNAME > /dev/null
curl -T $FNAME -s -u $YADISK_USERNAME:$YADISK_PASSWORD https://webdav.yandex.ru/XashTestVersions/current-$FILE_BASE-$TRAVIS_BRANCH.$FILE_EXT > /dev/null
2016-11-24 07:36:00 +01:00
shift
done
exit 0