From 4827ad1b157dac4ac47f0b1a316dd66ad90c0bd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Harrault?= <benoit@harrault.fr> Date: Tue, 15 Oct 2024 13:59:50 +0200 Subject: [PATCH] Fix build process --- .gitlab-ci.yml | 6 ++++-- pubspec.yaml | 2 +- test.sh | 12 ++++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100755 test.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index be28531..8160b8f 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 88de42e..df35c73 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 0000000..5bfee41 --- /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 -- GitLab