2017-04-13 10:14:19 +03:00
|
|
|
#!/bin/bash
|
|
|
|
date=$(date +%Y%m%d)
|
|
|
|
|
|
|
|
# use current date for version code/name
|
2019-04-08 14:57:13 +03:00
|
|
|
sed -i "/versionDev/,/\}/ s/versionCode .*/versionCode $date/" build.gradle
|
|
|
|
sed -i "/versionDev/,/\}/ s/versionName .*/versionName \"$date\"/" build.gradle
|
2017-04-13 10:14:19 +03:00
|
|
|
|
|
|
|
# build signed apk
|
|
|
|
./gradlew assembleVersionDevRelease >> /tmp/dev.log 2>&1
|
|
|
|
|
2019-04-08 14:57:13 +03:00
|
|
|
if [ $? != 0 ] ; then
|
2017-04-13 10:14:19 +03:00
|
|
|
echo "Build error!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# sign
|
2018-04-23 10:50:50 +03:00
|
|
|
mkdir -p ~/apks
|
|
|
|
|
2017-04-13 10:14:19 +03:00
|
|
|
source ~/.gradle/devVersionSecrets
|
2017-12-12 09:58:25 +03:00
|
|
|
/home/nextcloud/bin/apksigner sign --ks-pass env:VERSION_DEV_STORE_PASSWORD \
|
2017-04-13 10:14:19 +03:00
|
|
|
--key-pass env:VERSION_DEV_KEY_PASSWORD \
|
|
|
|
--ks $VERSION_DEV_STORE_FILE \
|
2018-04-23 10:50:50 +03:00
|
|
|
--out ~/apks/nextcloud-dev-$date.apk \
|
|
|
|
./build/outputs/apk/versionDev/release/versionDev-release-$date.apk
|
2017-04-13 10:14:19 +03:00
|
|
|
|
|
|
|
# use the current date
|
|
|
|
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
|
|
|
|
|
2019-04-08 14:57:13 +03:00
|
|
|
lastBuildTime=$(date --date="$(git log -1 --format=%ai $(git tag | grep dev | tail -n1))" +%s)
|
2019-05-16 16:09:33 +03:00
|
|
|
changelog=$(git log --after=$lastBuildTime --pretty=oneline --abbrev-commit)
|
2019-04-08 14:57:13 +03:00
|
|
|
|
2020-01-23 15:40:35 +03:00
|
|
|
libraryCommit=$(curl https://api.github.com/repos/nextcloud/android-library/commits/master | jq .sha | sed s'/\"//g')
|
|
|
|
|
|
|
|
# changelog
|
2019-05-17 08:52:20 +03:00
|
|
|
echo "$changelog" > src/versionDev/fastlane/metadata/android/en-US/changelogs/$date.txt
|
2020-01-23 15:40:35 +03:00
|
|
|
echo "library commit: $libraryCommit" >> src/versionDev/fastlane/metadata/android/en-US/changelogs/$date.txt
|
|
|
|
|
|
|
|
# build
|
|
|
|
sed -i s"# androidLibraryVersion.*#androidLibraryVersion =\"$libraryCommit\"#" build.gradle
|
2019-12-16 10:34:00 +03:00
|
|
|
|
2020-01-29 10:38:03 +03:00
|
|
|
git add .
|
2019-04-08 14:57:13 +03:00
|
|
|
git commit -m "daily dev $date" -m "$changelog"
|
2017-12-08 13:39:48 +03:00
|
|
|
git push
|
2017-12-04 10:26:20 +03:00
|
|
|
|
2017-04-13 10:14:19 +03:00
|
|
|
git tag dev-$date
|
|
|
|
git push origin dev-$date
|