From fe825181c9c2724facdbfc46bed260bedaa890e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20Harrault?= <benoit@harrault.fr>
Date: Mon, 14 Oct 2024 18:03:39 +0200
Subject: [PATCH] Fix "android:build-release" CI step

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

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9070399..c2b7a9a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -53,9 +53,8 @@ android:build-release:
     - echo keyAlias=$ANDROID_KEY_ALIAS >> android/key.properties
     - echo keyPassword=$ANDROID_KEY_PASSWORD >> android/key.properties
     # build flutter app
-    - VERSION_FILE="$(find . -name 'gradle.properties' | head -n1)"
-    - VERSION_NAME="$(grep '^app.versionName=' "${VERSION_FILE}" | cut -d'=' -f2)"
-    - VERSION_CODE="$(grep '^app.versionCode=' "${VERSION_FILE}" | cut -d'=' -f2)"
+    - VERSION_NAME="$(grep '^version:' pubspec.yaml | cut -d' ' -f2 | cut -d'+' -f1)"
+    - VERSION_CODE="$(grep '^version:' pubspec.yaml | cut -d' ' -f2 | cut -d'+' -f2)"
     - TAG_NAME="Release_${VERSION_NAME}_${VERSION_CODE}"
     - echo "${TAG_NAME}"
     - >
@@ -91,7 +90,6 @@ application:release:
     - git config user.email "${GITLAB_USER_EMAIL}"
     - git config user.name "${GITLAB_USER_NAME}"
     - git remote set-url origin https://oauth2:${GITLAB_ACCESS_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}
-    - VERSION_FILE="pubspec.yaml"
     - VERSION_NAME="$(grep '^version:' pubspec.yaml | cut -d' ' -f2 | cut -d'+' -f1)"
     - VERSION_CODE="$(grep '^version:' pubspec.yaml | cut -d' ' -f2 | cut -d'+' -f2)"
     - TAG_NAME="Release_${VERSION_NAME}_${VERSION_CODE}"
-- 
GitLab