From e7643937063b935d729f0fe931ca2eb501626dfe Mon Sep 17 00:00:00 2001 From: Remy Moll Date: Sat, 21 Dec 2024 15:54:04 +0000 Subject: [PATCH] Some more pipeline-fixes (#46) Reviewed-on: https://git.kluster.moll.re/anydev/anyway/pulls/46 --- frontend/.github/workflows/build_app_ios.yaml | 24 ++++++++++++++----- frontend/README.md | 5 ++-- frontend/ios/Podfile.lock | 16 ++++++------- frontend/ios/Runner/AppDelegate.swift | 4 +--- frontend/ios/fastlane/.env.sample | 2 +- frontend/ios/fastlane/Fastfile | 16 +++++++++++-- 6 files changed, 43 insertions(+), 24 deletions(-) diff --git a/frontend/.github/workflows/build_app_ios.yaml b/frontend/.github/workflows/build_app_ios.yaml index 7a97a20..4f35c33 100644 --- a/frontend/.github/workflows/build_app_ios.yaml +++ b/frontend/.github/workflows/build_app_ios.yaml @@ -6,14 +6,17 @@ on: jobs: build: 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 @@ -31,16 +34,24 @@ 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 + - name: Install dependencies and clean up + run: | + flutter pub get + bundle exec pod install + flutter clean + bundle exec pod cache clean --all 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 }} @@ -50,3 +61,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/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 diff --git a/frontend/ios/Runner/AppDelegate.swift b/frontend/ios/Runner/AppDelegate.swift index 675b021..2309a7b 100644 --- a/frontend/ios/Runner/AppDelegate.swift +++ b/frontend/ios/Runner/AppDelegate.swift @@ -8,9 +8,7 @@ import GoogleMaps _ application: UIApplication, 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 80fd68b..f3e23f4 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}", ) @@ -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 @@ -62,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", + "../Runner/AppDelegate.swift" + + ) + sh( "flutter", "build",