From 60660c7c2500bc73ae7b2035479c94369fc75640 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20Harrault?= <benoit@harrault.fr>
Date: Tue, 15 Oct 2024 10:38:07 +0200
Subject: [PATCH] Fix build process

---
 .gitlab-ci.yml | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8b5def6..be28531 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -33,7 +33,12 @@ android:build-debug:
     - flutter build apk --debug
     # prepare artifact
     - BASE_APK_FOLDER="build/app/outputs/flutter-apk"
-    - for APK in ${BASE_APK_FOLDER}/*.apk; do mv -v "${APK}" "$(echo "${APK}" | sed "s|\.apk|_${VERSION_CODE}.apk|")"; done
+    - >
+      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|")"
+        done
+      fi
     - find "${BASE_APK_FOLDER}" -name "*.apk" # where are my apk?
   artifacts:
     paths:
@@ -76,7 +81,12 @@ android:build-release:
         flutter build apk --release
       fi
     # prepare artifact
-    - for APK in ${BASE_APK_FOLDER}/*.apk; do mv -v "${APK}" "$(echo "${APK}" | sed "s|\.apk|_${VERSION_CODE}.apk|")"; done
+    - >
+      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|")"
+        done
+      fi
     - find "${BASE_APK_FOLDER}" -name "*.apk" # where are my apk?
   artifacts:
     paths:
-- 
GitLab