From 123b6313fba7b7a4136ecfe2f82086409236fb70 Mon Sep 17 00:00:00 2001 From: Remy Moll Date: Wed, 18 Dec 2024 15:50:56 +0100 Subject: [PATCH 1/4] some github-actions-specific adjustments --- frontend/.github/workflows/build_app_ios.yaml | 19 +++++++++++++++---- frontend/ios/fastlane/Fastfile | 4 +++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/frontend/.github/workflows/build_app_ios.yaml b/frontend/.github/workflows/build_app_ios.yaml index 7a97a20..1e3bbf5 100644 --- a/frontend/.github/workflows/build_app_ios.yaml +++ b/frontend/.github/workflows/build_app_ios.yaml @@ -5,7 +5,7 @@ on: jobs: build: - runs-on: macos-latest + runs-on: macos-15 steps: - uses: actions/checkout@v4 @@ -31,16 +31,27 @@ jobs: echo "BUILD_NAME=${REF_NAME//v}" >> $GITHUB_ENV - name: Setup SSH key for match git repo - run: echo "$MATCH_REPO_SSH_KEY" | base64 --decode > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa + # and mark the host as known + run: | + echo $MATCH_REPO_SSH_KEY | base64 --decode > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan -p 2222 git.kluster.moll.re > ~/.ssh/known_hosts env: MATCH_REPO_SSH_KEY: ${{ secrets.IOS_MATCH_REPO_SSH_KEY_BASE64 }} - name: Install fastlane - run: bundle install + run: bundle install && bundle update + working-directory: ios + + - name: Install dependencies + run: | + flutter pub get + bundle exec pod install + bundle exec pod update working-directory: ios - name: Run fastlane lane - run: bundle exec fastlane deploy_release + run: bundle exec fastlane deploy_release --verbose working-directory: ios env: BUILD_NUMBER: ${{ github.run_number }} diff --git a/frontend/ios/fastlane/Fastfile b/frontend/ios/fastlane/Fastfile index 80fd68b..d7a0c53 100644 --- a/frontend/ios/fastlane/Fastfile +++ b/frontend/ios/fastlane/Fastfile @@ -44,7 +44,9 @@ platform :ios do archive_path: "../build/ios/archive/Runner.xcarchive" ) - upload_to_testflight + upload_to_testflight( + skip_waiting_for_build_processing: true, + ) end -- 2.47.2 From f947b41f24c91484b116065b5869a9abed341438 Mon Sep 17 00:00:00 2001 From: Remy Moll Date: Thu, 19 Dec 2024 22:43:26 +0100 Subject: [PATCH 2/4] fix google map secrets --- frontend/.github/workflows/build_app_ios.yaml | 8 +++++--- frontend/README.md | 5 ++--- frontend/ios/Runner/AppDelegate.swift | 3 +-- frontend/ios/fastlane/.env.sample | 2 +- frontend/ios/fastlane/Fastfile | 12 +++++++++++- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/frontend/.github/workflows/build_app_ios.yaml b/frontend/.github/workflows/build_app_ios.yaml index 1e3bbf5..15e63c7 100644 --- a/frontend/.github/workflows/build_app_ios.yaml +++ b/frontend/.github/workflows/build_app_ios.yaml @@ -40,14 +40,15 @@ jobs: MATCH_REPO_SSH_KEY: ${{ secrets.IOS_MATCH_REPO_SSH_KEY_BASE64 }} - name: Install fastlane - run: bundle install && bundle update + run: bundle install working-directory: ios - - name: Install dependencies + - name: Install dependencies and clean up run: | flutter pub get bundle exec pod install - bundle exec pod update + flutter clean + bundle exec pod cache clean --all working-directory: ios - name: Run fastlane lane @@ -61,3 +62,4 @@ jobs: IOS_ASC_ISSUER_ID: ${{ secrets.IOS_ASC_ISSUER_ID }} IOS_ASC_KEY: ${{ secrets.IOS_ASC_KEY }} MATCH_PASSWORD: ${{ secrets.IOS_MATCH_PASSWORD }} + IOS_GOOGLE_MAPS_API_KEY: ${{ secrets.IOS_GOOGLE_MAPS_API_KEY }} diff --git a/frontend/README.md b/frontend/README.md index 954d60d..740cf1e 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -50,13 +50,12 @@ Secrets used by fastlane are stored on hashicorp vault and are fetched by the CI ## Secrets These are mostly used by the CI/CD pipeline to deploy the application. The main usage for github actions is documented under [https://github.com/hashicorp/vault-action](https://github.com/hashicorp/vault-action). -**Global secrets** are used for both versions of the app (android and ios). -- `GOOGLE_MAPS_API_KEY` is used to authenticate with the Google Maps API **Platform-specific secrets** are used by the CI/CD pipeline to deploy to the respective app stores. +- `GOOGLE_MAPS_API_KEY` is used to authenticate with the Google Maps API and is scoped to the android platform - `ANDROID_KEYSTORE` is used to sign the android apk - `ANDROID_GOOGLE_KEY` is used to authenticate with the Google Play Store api -- `IOS_GOOGLE_...` +- `IOS_GOOGLE_MAPS_API_KEY` is used to authenticate with the Google Maps API and is scoped to the ios platform - `IOS_GOOGLE_...` - `IOS_GOOGLE_...` - `IOS_GOOGLE_...` \ No newline at end of file diff --git a/frontend/ios/Runner/AppDelegate.swift b/frontend/ios/Runner/AppDelegate.swift index 675b021..c3ad1bb 100644 --- a/frontend/ios/Runner/AppDelegate.swift +++ b/frontend/ios/Runner/AppDelegate.swift @@ -9,8 +9,7 @@ import GoogleMaps didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { // load the key from env - let key = ProcessInfo.processInfo.environment["GOOGLE_MAPS_API_KEY"]! - GMSServices.provideAPIKey(key) + GMSServices.provideAPIKey("IOS_GOOGLE_MAPS_API_KEY") GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } diff --git a/frontend/ios/fastlane/.env.sample b/frontend/ios/fastlane/.env.sample index 82595b4..e23af2b 100644 --- a/frontend/ios/fastlane/.env.sample +++ b/frontend/ios/fastlane/.env.sample @@ -10,4 +10,4 @@ IOS_ASC_ISSUER_ID="sample" SIGNING_KEY_FILE_PATH="sample" SIGNING_KEY_PASSWORD="sample" -GOOGLE_MAPS_API_KEY="sample" +IOS_GOOGLE_MAPS_API_KEY="sample" diff --git a/frontend/ios/fastlane/Fastfile b/frontend/ios/fastlane/Fastfile index d7a0c53..6be2c9d 100644 --- a/frontend/ios/fastlane/Fastfile +++ b/frontend/ios/fastlane/Fastfile @@ -33,7 +33,7 @@ platform :ios do "flutter", "build", "ipa", - "--release", + "--debug", "--build-name=#{build_name}", "--build-number=#{build_number}", ) @@ -64,6 +64,16 @@ platform :ios do readonly: true, ) + # replace secrets by real values, the stupid way + sh( + "sed", + "-i", + "", + "s/IOS_GOOGLE_MAPS_API_KEY/#{ENV["IOS_GOOGLE_MAPS_API_KEY"]}/g", + "ios/Runner/AppDelegate.swift" + + ) + sh( "flutter", "build", -- 2.47.2 From a1864f5cce2f2e7ec62890a279045c3e0ce6f5f2 Mon Sep 17 00:00:00 2001 From: Remy Moll Date: Thu, 19 Dec 2024 22:44:56 +0100 Subject: [PATCH 3/4] cocoapods updates --- frontend/ios/Podfile.lock | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/frontend/ios/Podfile.lock b/frontend/ios/Podfile.lock index fbeaa09..a14f074 100644 --- a/frontend/ios/Podfile.lock +++ b/frontend/ios/Podfile.lock @@ -4,17 +4,15 @@ PODS: - Flutter - geolocator_apple (1.2.0): - Flutter - - Google-Maps-iOS-Utils (6.0.0): + - Google-Maps-iOS-Utils (6.1.0): - GoogleMaps (~> 9.0) - google_maps_flutter_ios (0.0.1): - Flutter - Google-Maps-iOS-Utils (< 7.0, >= 5.0) - GoogleMaps (< 10.0, >= 8.4) - - GoogleMaps (9.1.1): - - GoogleMaps/Maps (= 9.1.1) - - GoogleMaps/Base (9.1.1) - - GoogleMaps/Maps (9.1.1): - - GoogleMaps/Base + - GoogleMaps (9.2.0): + - GoogleMaps/Maps (= 9.2.0) + - GoogleMaps/Maps (9.2.0) - map_launcher (0.0.1): - Flutter - path_provider_foundation (0.0.1): @@ -74,9 +72,9 @@ SPEC CHECKSUMS: Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 geocoding_ios: bcbdaa6bddd7d3129c9bcb8acddc5d8778689768 geolocator_apple: d981750b9f47dbdb02427e1476d9a04397beb8d9 - Google-Maps-iOS-Utils: cfe6a0239c7ca634b7e001ad059a6707143dc8dc + Google-Maps-iOS-Utils: 0a484b05ed21d88c9f9ebbacb007956edd508a96 google_maps_flutter_ios: 0291eb2aa252298a769b04d075e4a9d747ff7264 - GoogleMaps: 80ea184ed6bf44139f383a8b0e248ba3ec1cc8c9 + GoogleMaps: 634ec3ca99698b31ca2253d64f017217d70cfb38 map_launcher: fe43bda6720bb73c12fcc1bdd86123ff49a4d4d6 path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564 permission_handler_apple: 4ed2196e43d0651e8ff7ca3483a069d469701f2d @@ -84,6 +82,6 @@ SPEC CHECKSUMS: sqflite: c35dad70033b8862124f8337cc994a809fcd9fa3 url_launcher_ios: 694010445543906933d732453a59da0a173ae33d -PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 +PODFILE CHECKSUM: bd1a78910c05ac1e3a220e80f392c61ab2cc8789 COCOAPODS: 1.10.2 -- 2.47.2 From 85c74b1a169acd5ff60452bbf28c6861393132e4 Mon Sep 17 00:00:00 2001 From: Remy Moll Date: Sat, 21 Dec 2024 16:52:39 +0100 Subject: [PATCH 4/4] some more adjustments --- frontend/.github/workflows/build_app_ios.yaml | 13 ++++++------- frontend/ios/Runner/AppDelegate.swift | 1 - frontend/ios/fastlane/Fastfile | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/frontend/.github/workflows/build_app_ios.yaml b/frontend/.github/workflows/build_app_ios.yaml index 15e63c7..4f35c33 100644 --- a/frontend/.github/workflows/build_app_ios.yaml +++ b/frontend/.github/workflows/build_app_ios.yaml @@ -5,15 +5,18 @@ on: jobs: build: - runs-on: macos-15 + runs-on: macos-latest + env: + # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps + BUNDLE_GEMFILE: ios/Gemfile steps: - uses: actions/checkout@v4 - name: Set up ruby env uses: ruby/setup-ruby@v1 with: - ruby-version: 3.2.1 - bundler-cache: true + ruby-version: 3.3 + bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Install Flutter uses: subosito/flutter-action@v2 @@ -39,10 +42,6 @@ jobs: env: MATCH_REPO_SSH_KEY: ${{ secrets.IOS_MATCH_REPO_SSH_KEY_BASE64 }} - - name: Install fastlane - run: bundle install - working-directory: ios - - name: Install dependencies and clean up run: | flutter pub get diff --git a/frontend/ios/Runner/AppDelegate.swift b/frontend/ios/Runner/AppDelegate.swift index c3ad1bb..2309a7b 100644 --- a/frontend/ios/Runner/AppDelegate.swift +++ b/frontend/ios/Runner/AppDelegate.swift @@ -8,7 +8,6 @@ import GoogleMaps _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { - // load the key from env GMSServices.provideAPIKey("IOS_GOOGLE_MAPS_API_KEY") GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) diff --git a/frontend/ios/fastlane/Fastfile b/frontend/ios/fastlane/Fastfile index 6be2c9d..f3e23f4 100644 --- a/frontend/ios/fastlane/Fastfile +++ b/frontend/ios/fastlane/Fastfile @@ -70,7 +70,7 @@ platform :ios do "-i", "", "s/IOS_GOOGLE_MAPS_API_KEY/#{ENV["IOS_GOOGLE_MAPS_API_KEY"]}/g", - "ios/Runner/AppDelegate.swift" + "../Runner/AppDelegate.swift" ) -- 2.47.2