mirror of
https://github.com/yattee/yattee.git
synced 2026-05-02 13:37:50 +00:00
Pass is_key_content_base64: true to app_store_connect_api_key
The DEVELOPER_KEY_CONTENT secret is stored base64-encoded, so fastlane needs to be told to decode it before parsing. Matches the approach on rewrite/v2. Removes the openssl-shell-out workaround from the previous commits, which was solving the wrong problem.
This commit is contained in:
@@ -13,11 +13,10 @@
|
|||||||
# Uncomment the line if you want fastlane to automatically update itself
|
# Uncomment the line if you want fastlane to automatically update itself
|
||||||
# update_fastlane
|
# update_fastlane
|
||||||
|
|
||||||
require 'tempfile'
|
|
||||||
|
|
||||||
APP_NAME = ENV['APP_NAME']
|
APP_NAME = ENV['APP_NAME']
|
||||||
DEVELOPER_KEY_ID = ENV['DEVELOPER_KEY_ID']
|
DEVELOPER_KEY_ID = ENV['DEVELOPER_KEY_ID']
|
||||||
DEVELOPER_KEY_ISSUER_ID = ENV['DEVELOPER_KEY_ISSUER_ID']
|
DEVELOPER_KEY_ISSUER_ID = ENV['DEVELOPER_KEY_ISSUER_ID']
|
||||||
|
DEVELOPER_KEY_CONTENT = ENV['DEVELOPER_KEY_CONTENT']
|
||||||
TEAM_ID = ENV['TEAM_ID']
|
TEAM_ID = ENV['TEAM_ID']
|
||||||
TEMP_KEYCHAIN_USER = ENV['TEMP_KEYCHAIN_USER']
|
TEMP_KEYCHAIN_USER = ENV['TEMP_KEYCHAIN_USER']
|
||||||
TEMP_KEYCHAIN_PASSWORD = ENV['TEMP_KEYCHAIN_PASSWORD']
|
TEMP_KEYCHAIN_PASSWORD = ENV['TEMP_KEYCHAIN_PASSWORD']
|
||||||
@@ -25,27 +24,6 @@ DEVELOPER_APP_IDENTIFIER = ENV['DEVELOPER_APP_IDENTIFIER']
|
|||||||
GIT_AUTHORIZATION = ENV['GIT_AUTHORIZATION']
|
GIT_AUTHORIZATION = ENV['GIT_AUTHORIZATION']
|
||||||
TESTFLIGHT_EXTERNAL_GROUPS = ENV['TESTFLIGHT_EXTERNAL_GROUPS']
|
TESTFLIGHT_EXTERNAL_GROUPS = ENV['TESTFLIGHT_EXTERNAL_GROUPS']
|
||||||
|
|
||||||
# Ruby's OpenSSL bindings (via OpenSSL::PKey::EC.new in spaceship) raise
|
|
||||||
# "invalid curve name" on the hosted macOS runners when given Apple's PKCS#8
|
|
||||||
# .p8 key directly. Shelling out to the system openssl to emit SEC1/traditional
|
|
||||||
# PEM sidesteps the issue. See fastlane/fastlane#20593.
|
|
||||||
def developer_key_content
|
|
||||||
return @developer_key_content if defined?(@developer_key_content)
|
|
||||||
content = ENV['DEVELOPER_KEY_CONTENT']
|
|
||||||
return @developer_key_content = nil if content.nil? || content.empty?
|
|
||||||
# GitHub secrets carry multi-line PEMs as a single line with literal "\n"
|
|
||||||
# escapes; fastlane's action un-escapes these before use, so do the same
|
|
||||||
# here before invoking openssl.
|
|
||||||
content = content.gsub('\n', "\n")
|
|
||||||
@developer_key_content = Tempfile.open(['AuthKey', '.p8']) do |f|
|
|
||||||
f.write(content)
|
|
||||||
f.flush
|
|
||||||
converted = `openssl pkey -in #{f.path} -traditional 2>&1`
|
|
||||||
raise "Failed to convert P8 key: #{converted}" unless $?.success?
|
|
||||||
converted
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
XCODEPROJ = "#{APP_NAME}.xcodeproj"
|
XCODEPROJ = "#{APP_NAME}.xcodeproj"
|
||||||
|
|
||||||
def delete_temp_keychain(name)
|
def delete_temp_keychain(name)
|
||||||
@@ -101,7 +79,8 @@ platform :ios do
|
|||||||
api_key = app_store_connect_api_key(
|
api_key = app_store_connect_api_key(
|
||||||
key_id: DEVELOPER_KEY_ID,
|
key_id: DEVELOPER_KEY_ID,
|
||||||
issuer_id: DEVELOPER_KEY_ISSUER_ID,
|
issuer_id: DEVELOPER_KEY_ISSUER_ID,
|
||||||
key_content: developer_key_content
|
key_content: DEVELOPER_KEY_CONTENT,
|
||||||
|
is_key_content_base64: true
|
||||||
)
|
)
|
||||||
|
|
||||||
build = get_build_number(xcodeproj: XCODEPROJ)
|
build = get_build_number(xcodeproj: XCODEPROJ)
|
||||||
@@ -153,7 +132,8 @@ platform :tvos do
|
|||||||
api_key = app_store_connect_api_key(
|
api_key = app_store_connect_api_key(
|
||||||
key_id: DEVELOPER_KEY_ID,
|
key_id: DEVELOPER_KEY_ID,
|
||||||
issuer_id: DEVELOPER_KEY_ISSUER_ID,
|
issuer_id: DEVELOPER_KEY_ISSUER_ID,
|
||||||
key_content: developer_key_content
|
key_content: DEVELOPER_KEY_CONTENT,
|
||||||
|
is_key_content_base64: true
|
||||||
)
|
)
|
||||||
|
|
||||||
build = get_build_number(xcodeproj: XCODEPROJ)
|
build = get_build_number(xcodeproj: XCODEPROJ)
|
||||||
@@ -205,7 +185,8 @@ platform :mac do
|
|||||||
api_key = app_store_connect_api_key(
|
api_key = app_store_connect_api_key(
|
||||||
key_id: DEVELOPER_KEY_ID,
|
key_id: DEVELOPER_KEY_ID,
|
||||||
issuer_id: DEVELOPER_KEY_ISSUER_ID,
|
issuer_id: DEVELOPER_KEY_ISSUER_ID,
|
||||||
key_content: developer_key_content
|
key_content: DEVELOPER_KEY_CONTENT,
|
||||||
|
is_key_content_base64: true
|
||||||
)
|
)
|
||||||
|
|
||||||
build = get_build_number(xcodeproj: XCODEPROJ)
|
build = get_build_number(xcodeproj: XCODEPROJ)
|
||||||
@@ -256,7 +237,8 @@ platform :mac do
|
|||||||
api_key = app_store_connect_api_key(
|
api_key = app_store_connect_api_key(
|
||||||
key_id: DEVELOPER_KEY_ID,
|
key_id: DEVELOPER_KEY_ID,
|
||||||
issuer_id: DEVELOPER_KEY_ISSUER_ID,
|
issuer_id: DEVELOPER_KEY_ISSUER_ID,
|
||||||
key_content: developer_key_content
|
key_content: DEVELOPER_KEY_CONTENT,
|
||||||
|
is_key_content_base64: true
|
||||||
)
|
)
|
||||||
|
|
||||||
build = get_build_number(xcodeproj: XCODEPROJ)
|
build = get_build_number(xcodeproj: XCODEPROJ)
|
||||||
|
|||||||
Reference in New Issue
Block a user