proposal-system/mobile/fastlane/Fastfile
Adam Moussa 9cd12ceb79 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).
2026-05-18 19:30:56 -04:00

57 lines
1.4 KiB
Ruby

require 'openssl'
# Fastlane 2.234.0 uses OpenSSL::PKey::EC.new which rejects PKCS#8 keys on
# OpenSSL 3.x ("invalid curve name"). Prepend a wrapper that falls back to
# OpenSSL::PKey.read, which handles both PKCS#8 and SEC1 formats.
module OpenSSLECNewFix
def new(arg = nil, *rest)
super
rescue OpenSSL::PKey::ECError
raise if arg.nil? || !arg.is_a?(String)
OpenSSL::PKey.read(arg)
end
end
OpenSSL::PKey::EC.singleton_class.prepend(OpenSSLECNewFix)
default_platform(:ios)
platform :ios do
desc "Build and upload to TestFlight"
lane :beta do
setup_ci
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: is_base64
)
match(type: "appstore", readonly: true)
increment_build_number(
build_number: ENV["GITHUB_RUN_NUMBER"],
xcodeproj: "ios/ProposalSystem.xcodeproj"
)
build_app(
workspace: "ios/ProposalSystem.xcworkspace",
scheme: "ProposalSystem",
configuration: "Release",
export_method: "app-store",
output_directory: "build",
output_name: "ProposalSystem.ipa"
)
upload_to_testflight(skip_waiting_for_build_processing: true)
end
end