From 4d99715447a78b0749699e5f877c909ff2055543 Mon Sep 17 00:00:00 2001
From: Remy Moll <me@moll.re>
Date: Tue, 22 Oct 2024 16:23:53 +0200
Subject: [PATCH] build id fixes

---
 frontend/.github/workflows/build_app_android.yaml | 6 ++++--
 frontend/android/fastlane/Fastfile                | 9 ++++++---
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/frontend/.github/workflows/build_app_android.yaml b/frontend/.github/workflows/build_app_android.yaml
index 14df1a7..515010c 100644
--- a/frontend/.github/workflows/build_app_android.yaml
+++ b/frontend/.github/workflows/build_app_android.yaml
@@ -37,7 +37,7 @@ jobs:
           REF_NAME: ${{ github.ref_name }}
         run:
           # remove the 'v' prefix from the tag name
-          echo "VERSION_NAME=${REF_NAME//v}" >> $GITHUB_ENV
+          echo "BUILD_NAME=${REF_NAME//v}" >> $GITHUB_ENV
 
       - name: Load secrets from github
         run: |
@@ -53,4 +53,6 @@ jobs:
       - name: Run fastlane lane
         run: bundle exec fastlane deploy_testing
         working-directory: android
-        # the environment variable VERSION_NAME is implicitly available
+        env:
+          BUILD_NUMBER: ${{ github.run_number }}
+          # BUILD_NAME is implicitly available
diff --git a/frontend/android/fastlane/Fastfile b/frontend/android/fastlane/Fastfile
index 352e303..5a22870 100644
--- a/frontend/android/fastlane/Fastfile
+++ b/frontend/android/fastlane/Fastfile
@@ -5,16 +5,18 @@ default_platform(:android)
 
 platform :android do
 
-  desc "Deploy a new version as a preview version"
+  desc "Deploy a new version to closed testing"
   lane :deploy_testing do
-    version_name = ENV["VERSION_NAME"]
+    build_name = ENV["BUILD_NAME"]
+    build_number = ENV["BUILD_NUMBER"]
 
     sh(
       "flutter",
       "build",
       "appbundle",
       "--release",
-      "--build-name=#{version_name}",
+      "--build-name=#{build_name}",
+      "--build-number=#{build_number}",
       )
     
     upload_to_play_store(
@@ -32,6 +34,7 @@ platform :android do
   lane :deploy_release do
     gradle(
       task: "clean assembleRelease",
+      # todo update to a flutter call
       properties: {
         # loaded from environment
         "android.injected.version.name" => ENV["VERSION_NAME"],