From d053905ded2135d68f0251562d12225ac7114e14 Mon Sep 17 00:00:00 2001 From: Anxcye Date: Fri, 12 Jul 2024 10:31:02 +0800 Subject: [PATCH] build: add a script to rename apk file --- rename.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 rename.sh diff --git a/rename.sh b/rename.sh new file mode 100755 index 0000000..4ea1605 --- /dev/null +++ b/rename.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# check if version number is provided +if [ $# -eq 0 ]; then + echo "Please provide a version number." + echo "Usage: $0 " + exit 1 +fi + +VERSION=$1 +APP_NAME="Anx-Reader" +BUILD_DIR="build/app/outputs/flutter-apk" + +# rename_apk(old_name, arch) +rename_apk() { + local old_name=$1 + local arch=$2 + local new_name="${APP_NAME}-${VERSION}-${arch}.apk" + + mv "$BUILD_DIR/$old_name" "$BUILD_DIR/$new_name" + echo "Renamed: $old_name -> $new_name" +} + +# rename APK files +rename_apk "app-armeabi-v7a-release.apk" "armeabi-v7a" +rename_apk "app-arm64-v8a-release.apk" "arm64-v8a" +rename_apk "app-x86_64-release.apk" "x86_64" +rename_apk "app-release.apk" "universal" + +echo "Rename successful!" \ No newline at end of file