fix google map secrets

This commit is contained in:
Remy Moll 2024-12-19 22:43:26 +01:00
parent 123b6313fb
commit f947b41f24
5 changed files with 20 additions and 10 deletions

View File

@ -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 }}

View File

@ -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_...`

View File

@ -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)
}

View File

@ -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"

View File

@ -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",