Fix ASC key format detection: handle both raw PEM and base64

The secret may contain either raw PEM text (with BEGIN header) or
base64-encoded PEM. Detect format and pass appropriately to fastlane
instead of blindly base64-decoding (which corrupts raw PEM content).
This commit is contained in:
Adam Moussa 2026-05-18 19:30:56 -04:00
parent a0ccf676b8
commit 9cd12ceb79

View file

@ -20,12 +20,20 @@ platform :ios do
lane :beta do
setup_ci
key_content = Base64.decode64(ENV["ASC_KEY_CONTENT"])
raw = ENV["ASC_KEY_CONTENT"]
if raw.include?("BEGIN")
key_content = raw.gsub('\n', "\n")
is_base64 = false
else
key_content = raw
is_base64 = true
end
app_store_connect_api_key(
key_id: ENV["ASC_KEY_ID"],
issuer_id: ENV["ASC_ISSUER_ID"],
key_content: key_content,
is_key_content_base64: false
is_key_content_base64: is_base64
)
match(type: "appstore", readonly: true)