Keep only last 3 builds in archive

This commit is contained in:
Sayantan Santra 2022-10-12 18:19:38 -05:00
parent e78e0b6112
commit 20cfc90404

View file

@ -137,7 +137,7 @@ if [ -f "com.google.android.youtube.apk" ]; then
java -jar revanced-cli.jar -m revanced-integrations.apk -b revanced-patches.jar \ java -jar revanced-cli.jar -m revanced-integrations.apk -b revanced-patches.jar \
${patches[@]} \ ${patches[@]} \
$EXPERIMENTAL \ $EXPERIMENTAL \
-a com.google.android.youtube.apk -o revanced.apk -a com.google.android.youtube.apk -o revanced-yt.apk
else else
echo "Cannot find YouTube APK, skipping build" | tee -a build.log echo "Cannot find YouTube APK, skipping build" | tee -a build.log
fi fi
@ -155,14 +155,14 @@ if [ -f "com.google.android.apps.youtube.music.apk" ]; then
java -jar revanced-cli.jar -b revanced-patches.jar \ java -jar revanced-cli.jar -b revanced-patches.jar \
${patches[@]} \ ${patches[@]} \
$EXPERIMENTAL \ $EXPERIMENTAL \
-a com.google.android.apps.youtube.music.apk -o revanced-music.apk -a com.google.android.apps.youtube.music.apk -o revanced-ytm.apk
else else
echo "Cannot find YouTube Music APK, skipping build" | tee -a build.log echo "Cannot find YouTube Music APK, skipping build" | tee -a build.log
fi fi
# Rename files # Rename files
mv revanced.apk ReVanced-nonroot-$timestamp.apk mv revanced-yt.apk YouTube_ReVanced_nonroot_$timestamp.apk
mv revanced-music.apk ReVanced-Music-nonroot-$timestamp.apk mv revanced-ytm.apk YouTube_Music_ReVanced_nonroot_$timestamp.apk
# Send telegram message about the new build # Send telegram message about the new build
echo "Sending messages to telegram" | tee -a build.log echo "Sending messages to telegram" | tee -a build.log
@ -177,5 +177,9 @@ msg=$(cat versions.json | tail -n+2 | head -n-1 | cut -c3- | sed "s/\"//g" | sed
# Do some cleanup # Do some cleanup
mkdir -p archive mkdir -p archive
mv ReVanced*.apk archive/ mv YouTube_*.apk archive/
find archive/ -mtime +3 -exec rm {} \; find /srv/backups -maxdepth 1 -type f -printf '%Ts\t%P\n' \
| sort -rn \
| tail -n +6 \
| cut -f2- \
| xargs -r r