nextcloud-android/scripts/buildDev
Tobias Kaminsky 6cdf0e1ba4
Update buildDev
do not push twice
2017-12-04 08:54:12 +01:00

42 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
date=$(date +%Y%m%d)
# use current date for version code/name
sed -i "/versionDev/,/\}/ s/versionCode .*/versionCode $date/" build.gradle
sed -i "/versionDev/,/\}/ s/versionName .*/versionName \"$date\"/" build.gradle
# build signed apk
./gradlew assembleVersionDevRelease >> /tmp/dev.log 2>&1
if [ $? != 0 ] ; then
echo "Build error!"
exit 1
fi
# sign
source ~/.gradle/devVersionSecrets
apksigner sign --ks-pass env:VERSION_DEV_STORE_PASSWORD \
--key-pass env:VERSION_DEV_KEY_PASSWORD \
--ks $VERSION_DEV_STORE_FILE \
--out ~/apks/nextcloud-dev-$date.apk \
./build/outputs/apk/versionDev/release/android-versionDev-release-unsigned.apk
# use the current date
mkdir -p ~/apks
echo $date > ~/apks/latest
ln -s nextcloud-dev-$date.apk latest.apk
mv latest.apk ~/apks/
# remove all but the latest 5 apks
/bin/ls -t ~/apks/*.apk | awk 'NR>6' | xargs rm -f
git add build.gradle
git commit -m "daily dev $date"
git tag dev-$date
git push origin dev-$date
# remove all but the latest 5 tags
git tag|grep dev | sort -r | awk 'NR>5' | xargs -n 1 git push --delete origin
git tag|grep dev | sort -r | awk 'NR>5' | xargs -n 1 git tag -d