diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index be285311d88d83f5e420d27c2429c3369964f792..8160b8fa22ad048504de4b6877cf26a99896c45d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -33,10 +33,11 @@ android:build-debug: - flutter build apk --debug # prepare artifact - BASE_APK_FOLDER="build/app/outputs/flutter-apk" + - APP_NAME="$(grep 'namespace' android/app/build.gradle | cut -d'"' -f2)" - > if [ "$(find "${BASE_APK_FOLDER}" -name "*.apk")" != "" ]; then for APK in ${BASE_APK_FOLDER}/*.apk; do - mv -v "${APK}" "$(echo "${APK}" | sed "s|\.apk|_${VERSION_CODE}.apk|")" + mv -v "${APK}" "$(echo "${APK}" | sed "s|\.apk|_${VERSION_CODE}.apk|" | sed "s|/app-|/${APP_NAME}-|")" done fi - find "${BASE_APK_FOLDER}" -name "*.apk" # where are my apk? @@ -69,6 +70,7 @@ android:build-release: - mkdir -p "${BASE_APK_FOLDER}" - VERSION_NAME="$(grep '^version:' pubspec.yaml | cut -d' ' -f2 | cut -d'+' -f1)" - VERSION_CODE="$(grep '^version:' pubspec.yaml | cut -d' ' -f2 | cut -d'+' -f2)" + - APP_NAME="$(grep 'namespace' android/app/build.gradle | cut -d'"' -f2)" - TAG_NAME="Release_${VERSION_NAME}_${VERSION_CODE}" - echo "${TAG_NAME}" - > @@ -84,7 +86,7 @@ android:build-release: - > if [ "$(find "${BASE_APK_FOLDER}" -name "*.apk")" != "" ]; then for APK in ${BASE_APK_FOLDER}/*.apk; do - mv -v "${APK}" "$(echo "${APK}" | sed "s|\.apk|_${VERSION_CODE}.apk|")" + mv -v "${APK}" "$(echo "${APK}" | sed "s|\.apk|_${VERSION_CODE}.apk|" | sed "s|/app-|/${APP_NAME}-|")" done fi - find "${BASE_APK_FOLDER}" -name "*.apk" # where are my apk? diff --git a/pubspec.yaml b/pubspec.yaml index 88de42eb7d5ba8261632e45983d416c55514689c..df35c73a3cdfe7fed306c50862acdb0c7b7a9000 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: A random application, for testing purpose only. publish_to: "none" -version: 1.0.60+61 +version: 1.0.61+62 environment: sdk: "^3.0.0" diff --git a/test.sh b/test.sh new file mode 100755 index 0000000000000000000000000000000000000000..5bfee41b399d63bf5e03f14f6ae786dc7c9ec768 --- /dev/null +++ b/test.sh @@ -0,0 +1,12 @@ +#!/bin/bash -i + +BASE_APK_FOLDER="build/app/outputs/flutter-apk" +VERSION_NAME="$(grep '^version:' pubspec.yaml | cut -d' ' -f2 | cut -d'+' -f1)" +VERSION_CODE="$(grep '^version:' pubspec.yaml | cut -d' ' -f2 | cut -d'+' -f2)" +APP_NAME="$(grep 'namespace' android/app/build.gradle | cut -d'"' -f2)" + +if [ "$(find "${BASE_APK_FOLDER}" -name "*.apk")" != "" ]; then + for APK in ${BASE_APK_FOLDER}/*.apk; do + mv -v "${APK}" "$(echo "${APK}" | sed "s|\.apk|_${VERSION_CODE}.apk|" | sed "s|/app-|/${APP_NAME}-|")" + done +fi