From cc2cd8ea68f56b60a85e6c6923050bcddc80eb09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Thu, 27 Apr 2023 16:52:22 +0200 Subject: [PATCH] fix: update syntax (#2) --- .../ios_crendentials.json | 2 +- .../ios_cd/actions/build_and_deploy_action.rb | 38 ++++++++++--------- .../plugin/ios_cd/helper/ios_cd_helper.rb | 8 ++-- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/plugins/fastlane-plugin-ios_cd/ios_crendentials.json b/plugins/fastlane-plugin-ios_cd/ios_crendentials.json index 44c3dbe..909147c 100644 --- a/plugins/fastlane-plugin-ios_cd/ios_crendentials.json +++ b/plugins/fastlane-plugin-ios_cd/ios_crendentials.json @@ -8,7 +8,7 @@ ], "apple_issuer_id":"69a6de90-9fe1-47e3-e053-5b8c7c11a4d1", "apple_key_id":"VBRDBQM7SJ", - "apple_key_content":"-----BEGIN PRIVATE KEY-----MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgxLuVvuI7DafrGHTzATTtdB1TgIFkb12qFVyNSj4kuE+gCgYIKoZIzj0DAQehRANCAAQl7PyxfJR2QoKCmpqvjG4mQxMIzehm9TsLAjwLrPya4LWRyxrEEvPG/N5L06udHtv26gLDMR5gY6uOY1pVJX28-----END PRIVATE KEY-----", + "apple_key_content":"-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgxLuVvuI7DafrGHTz\nATTtdB1TgIFkb12qFVyNSj4kuE+gCgYIKoZIzj0DAQehRANCAAQl7PyxfJR2QoKC\nmpqvjG4mQxMIzehm9TsLAjwLrPya4LWRyxrEEvPG/N5L06udHtv26gLDMR5gY6uO\nY1pVJX28\n-----END PRIVATE KEY-----", "provisioning_profiles":{ "1624036332": "match AppStore com.jaggerlewis.jl3", "com.jaggerlewis.jl3.OneSignalNotificationServiceExtension": "match AppStore com.jaggerlewis.jl3.OneSignalNotificationServiceExtension" diff --git a/plugins/fastlane-plugin-ios_cd/lib/fastlane/plugin/ios_cd/actions/build_and_deploy_action.rb b/plugins/fastlane-plugin-ios_cd/lib/fastlane/plugin/ios_cd/actions/build_and_deploy_action.rb index 588919e..e8c3f8f 100644 --- a/plugins/fastlane-plugin-ios_cd/lib/fastlane/plugin/ios_cd/actions/build_and_deploy_action.rb +++ b/plugins/fastlane-plugin-ios_cd/lib/fastlane/plugin/ios_cd/actions/build_and_deploy_action.rb @@ -19,48 +19,50 @@ module Fastlane # Retrieve credentials creds = Helper::IosCdHelper.parseIosCredentials('.') - UI.message(creds.to_s) - # Ensure temporary keychain exists Helper::IosCdHelper.ensure_temp_keychain(creds['temp_keychain_user'], creds['temp_keychain_password']) # Obtain App Store Connect API key - api_key = Actions::AppStoreConnectApiKeyAction.run({ - key_id: creds['apple_key_id'], - issuer_id: creds['apple_issuer_id'], - key_content: creds['apple_key_content'], + api_key = Actions::AppStoreConnectApiKeyAction.run( + key_id: creds['apple_key_id'].to_s, + issuer_id: creds['apple_issuer_id'].to_s, + key_content: creds['apple_key_content'].to_s, duration: 1200, in_house: false - }) + ) # Increment build number for latest TestFlight build - Actions::IncrementBuildNumberAction.run({ - build_number: Actions::LatestTestflightBuildNumberAction.run({}) + 1, + Actions::IncrementBuildNumberAction.run( + build_number: Actions::LatestTestflightBuildNumberAction.run( + api_key: api_key, + team_id: "118579280", + team_name: "Jagger & Lewis" + ) + 1, xcodeproj: "Runner.xcodeproj" - }) + ) # Install Cocoapods - Actions::CocoapodsAction.run({ + Actions::CocoapodsAction.run( clean_install: true - }) + ) # Set up code signing using match # Configures and runs `match` which manages code signing certificates and provisioning profiles for the project. # The function takes the app's bundle identifier, an authorization token for the project's Git repository, and the name and password for a temporary keychain used to store the signing certificate. # It uses the App Store Connect API key to access the App Store and increment the build number. # It then runs `gym` to build and sign the app using the selected provisioning profile, and finally, uses `pilot` to upload the app to TestFlight for beta testing. - Actions::MatchAction.run({ + Actions::MatchAction.run( type: 'appstore', app_identifier: creds['app_identifier_extensions'], git_basic_authorization: Base64.strict_encode64(ENV["GIT_AUTHORIZATION"]), keychain_name: creds['temp_keychain_user'], keychain_password: creds['temp_keychain_password'], api_key: api_key - }) + ) # Build and export app using Gym # Builds and packages an iOS app or framework for distribution to the App Store, TestFlight, or Enterprise distribution. - Actions::GymAction.run({ + Actions::GymAction.run( configuration: "Release", workspace: "Runner.xcworkspace", scheme: "your_schema", @@ -68,10 +70,10 @@ module Fastlane export_options: { provisioningProfiles: creds['provisioning_profiles'] } - }) + ) # Upload build to App Store Connect using Pilot - Actions::PilotAction.run({ + Actions::PilotAction.run( apple_id: creds['developer_app_id'].to_s, app_identifier: creds['developer_app_identifier'].to_s, skip_waiting_for_build_processing: true, @@ -79,7 +81,7 @@ module Fastlane distribute_external: false, notify_external_testers: false, ipa: "./Runner.ipa" - }) + ) Actions::DeleteTempKeychainAction.run end diff --git a/plugins/fastlane-plugin-ios_cd/lib/fastlane/plugin/ios_cd/helper/ios_cd_helper.rb b/plugins/fastlane-plugin-ios_cd/lib/fastlane/plugin/ios_cd/helper/ios_cd_helper.rb index aa7860e..308892f 100644 --- a/plugins/fastlane-plugin-ios_cd/lib/fastlane/plugin/ios_cd/helper/ios_cd_helper.rb +++ b/plugins/fastlane-plugin-ios_cd/lib/fastlane/plugin/ios_cd/helper/ios_cd_helper.rb @@ -8,20 +8,20 @@ module Fastlane # Define method to delete temporary keychain def self.delete_temp_keychain(name) if File.exist?(File.expand_path("~/Library/Keychains/#{name}-db")) - Actions::DeleteKeychainAction.run({ + Actions::DeleteKeychainAction.run( name: name - }) + ) end end # Define method to create temporary keychain def self.create_temp_keychain(name, password) - Actions::CreateKeychainAction.run({ + Actions::CreateKeychainAction.run( name: name, password: password, unlock: false, timeout: 0 - }) + ) end # Define method to ensure that temporary keychain exists