This commit is contained in:
Marcos Rodriguez Velez 2025-03-02 00:02:05 -04:00
parent a62a21b28b
commit 863ac46bc8
2 changed files with 70 additions and 38 deletions

View file

@ -238,26 +238,52 @@ platform :ios do
desc "Synchronize certificates and provisioning profiles"
lane :setup_provisioning_profiles do
required_vars = ["GIT_ACCESS_TOKEN", "GIT_URL", "ITC_TEAM_ID", "ITC_TEAM_NAME", "KEYCHAIN_PASSWORD"]
ensure_env_vars(required_vars)
UI.message("Setting up provisioning profiles...")
platform = "ios"
max_retries = 3
# Iterate over app identifiers to fetch provisioning profiles
app_identifiers.each do |app_identifier|
match(
git_basic_authorization: ENV["GIT_ACCESS_TOKEN"],
git_url: ENV["GIT_URL"],
type: "appstore",
clone_branch_directly: true, # Skip if the branch already exists
platform: platform,
app_identifier: app_identifier,
team_id: ENV["ITC_TEAM_ID"],
team_name: ENV["ITC_TEAM_NAME"],
readonly: true,
keychain_name: "temp_keychain",
keychain_password: ENV["KEYCHAIN_PASSWORD"]
)
retries = 0
success = false
while !success && retries < max_retries
begin
UI.message("Fetching provisioning profile for #{app_identifier} (attempt #{retries + 1}/#{max_retries})...")
match(
git_basic_authorization: ENV["GIT_ACCESS_TOKEN"],
git_url: ENV["GIT_URL"],
type: "appstore",
clone_branch_directly: true,
platform: "ios",
app_identifier: app_identifier,
team_id: ENV["ITC_TEAM_ID"],
team_name: ENV["ITC_TEAM_NAME"],
readonly: true,
keychain_name: "temp_keychain",
keychain_password: ENV["KEYCHAIN_PASSWORD"]
)
success = true
log_success("Successfully fetched provisioning profile for #{app_identifier}")
rescue => e
retries += 1
if retries < max_retries
wait_time = 10 * retries # Exponential backoff
log_error("Failed to fetch provisioning profile for #{app_identifier}: #{e.message}")
UI.message("Retrying in #{wait_time} seconds...")
sleep(wait_time)
else
log_error("Failed to fetch provisioning profile for #{app_identifier} after #{max_retries} attempts: #{e.message}")
raise e
end
end
end
end
log_success("All provisioning profiles set up")
end
desc "Fetch development certificates and provisioning profiles for Mac Catalyst"

View file

@ -3,33 +3,39 @@
# URL of the Git repository to store the certificates
git_url(ENV["GIT_URL"])
# Define the type of match to run, could be one of 'appstore', 'adhoc', 'development', or 'enterprise'.
# For example, use 'appstore' for App Store builds, 'adhoc' for Ad Hoc distribution,
# 'development' for development builds, and 'enterprise' for In-House (enterprise) distribution.
type("appstore")
# Define the type of match to run
# Default to "appstore" but can be overridden
type(ENV["MATCH_TYPE"] || "appstore")
app_identifier(["io.bluewallet.bluewallet", "io.bluewallet.bluewallet.watch", "io.bluewallet.bluewallet.watch.extension", "io.bluewallet.bluewallet.Stickers", "io.bluewallet.bluewallet.MarketWidget"]) # Replace with your app identifiers
# App identifiers for all BlueWallet apps
app_identifier([
"io.bluewallet.bluewallet",
"io.bluewallet.bluewallet.watch",
"io.bluewallet.bluewallet.watch.extension",
"io.bluewallet.bluewallet.Stickers",
"io.bluewallet.bluewallet.MarketWidget"
])
# List of app identifiers to create provisioning profiles for.
# Replace with your app's bundle identifier(s).
# Your Apple Developer account email address.
# Your Apple Developer account email address
username(ENV["APPLE_ID"])
# The ID of your Apple Developer team if you're part of multiple teams
# The ID of your Apple Developer team
team_id(ENV["ITC_TEAM_ID"])
# Set this to true if match should only read existing certificates and profiles
# and not create new ones.
readonly(true)
# Set readonly based on environment (default to true for safety)
# Set to false explicitly when new profiles need to be created
readonly(ENV["MATCH_READONLY"] == "false" ? false : true)
# Optional: The Git branch that is used for match.
# Default is 'master'.
# Optional: Path to a specific SSH key to be used by match.
# Only needed if you're using a private repository and match needs to use SSH keys for authentication.
# ssh_key("/path/to/your/private/key")
# Optional: Define the platform to use, can be 'ios', 'macos', or 'tvos'.
# For React Native projects, you'll typically use 'ios'.
# Define the platform to use
platform("ios")
# Git basic authentication through access token
# This is useful for CI/CD environments where SSH keys aren't available
git_basic_authorization(ENV["GIT_ACCESS_TOKEN"])
# Storage mode (git by default)
storage_mode("git")
# Optional: The Git branch that is used for match
# Default is 'master'
# branch("main")