refactor: use other_action keyword to call native fastane actions

This commit is contained in:
Malo Léon 2023-05-02 09:30:21 +02:00
parent 6e7befa067
commit 1c6b04e511
2 changed files with 11 additions and 10 deletions

View File

@ -26,17 +26,18 @@ module Fastlane
UI.message("👉🏼 New keychain created")
# Obtain App Store Connect API key
api_key = Fastlane::Actions.app_store_connect_api_key(
api_key = other_action.app_store_connect_api_key(
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
)
UI.message("👉🏼 API Key formated")
last_testflight_build_number =
Fastlane::Actions.latest_testflight_build_number(
other_action.latest_testflight_build_number(
api_key: api_key,
team_id: "118579280",
team_name: "Jagger & Lewis",
@ -46,14 +47,14 @@ module Fastlane
) + 1
# Increment build number for latest TestFlight build
Fastlane::Actions.increment_build_number(
other_action.increment_build_number(
build_number: last_testflight_build_number + 1,
xcodeproj: "Runner.xcodeproj"
)
UI.message("👉🏼 Build number incremented")
# Install Cocoapods
Fastlane::Actions.cocoapods(
other_action.cocoapods(
clean_install: true,
clean: true,
integrate: true,
@ -66,7 +67,7 @@ module Fastlane
# 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.
Fastlane::Actions.match(
other_action.match(
api_key: api_key,
type: 'appstore',
app_identifier: creds['app_identifier_extensions'],
@ -84,7 +85,7 @@ module Fastlane
# Build and export app using Gym
# Builds and packages an iOS app or framework for distribution to the App Store, TestFlight, or Enterprise distribution.
Fastlane::Actions.gym(
other_action.gym(
configuration: "Release",
workspace: "Runner.xcworkspace",
scheme: "your_schema",
@ -96,7 +97,7 @@ module Fastlane
UI.message("👉🏼 App built")
# Upload build to App Store Connect using Pilot
Fastlane::Actions.pilot(
other_action.pilot(
api_key: api_key,
username: "leonmalo@sfr.fr",
team_id: "118579280",
@ -111,7 +112,7 @@ module Fastlane
)
UI.message("👉🏼 App uploaded")
Fastlane::Actions.deleteTemp_keychain
other_action.deleteTemp_keychain
end
def self.description

View File

@ -8,7 +8,7 @@ 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(
other_action.deelete_keychain.run(
name: name
)
end
@ -16,7 +16,7 @@ module Fastlane
# Define method to create temporary keychain
def self.create_temp_keychain(name, password)
Actions::CreateKeychainAction.run(
other_actions.create_keychain_action.run(
name: name,
password: password,
unlock: false,