Skip to content

Commit

Permalink
add option to skip keychain deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaxjiang96 committed Jul 11, 2023
1 parent 82811e6 commit d7ed4e9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ inputs:
description: 'Custom Keychain Name'
required: false
default: "ios-build.keychain"
skip-keychain-deletion:
description: 'Skip Keychain deletion'
required: false
default: ""
runs:
using: "node16"
main: "dist/index.js"
20 changes: 8 additions & 12 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,16 @@ platform :ios do
lane :export_ipa do
decode_file

keychain_password = SecureRandom.uuid
keychain_name = nil
if !ENV['CUSTOM_KEYCHAIN_NAME'].empty?
keychain_name = ENV['CUSTOM_KEYCHAIN_NAME']
else
keychain_name = 'ios-build.keychain'
end

begin
delete_keychain(name: keychain_name)
rescue => ex
UI.error(ex)
end
create_keychain(
name: keychain_name,
password: keychain_password,
password: "",
default_keychain: false,
unlock: true,
timeout: 3600
Expand All @@ -36,7 +30,7 @@ platform :ios do
end,
certificate_password: ENV['CERTIFICATE_PASSWORD'],
keychain_name: keychain_name,
keychain_password: keychain_password,
keychain_password: "",
log_output: true
)
import_certificate(
Expand All @@ -48,7 +42,7 @@ platform :ios do
end,
certificate_password: ENV['CERTIFICATE_PASSWORD'],
keychain_name: keychain_name,
keychain_password: keychain_password,
keychain_password: "",
log_output: true
)
else
Expand All @@ -57,7 +51,7 @@ platform :ios do
!ENV['P12_PATH'].empty? ? ENV['P12_PATH'] : 'ios-build.p12',
certificate_password: ENV['CERTIFICATE_PASSWORD'],
keychain_name: keychain_name,
keychain_password: keychain_password,
keychain_password: "",
log_output: true
)
end
Expand Down Expand Up @@ -220,8 +214,10 @@ platform :ios do
destination: use_build_destination ? ENV['BUILD_DESTINATION'] : nil,
build_path: use_build_path ? ENV['BUILD_PATH'] : nil
)

delete_keychain(name: keychain_name)
# if ENV['SKIP_KEYCHAIN_DELETION'].empty? ||
# ENV['SKIP_KEYCHAIN_DELETION'] != 'true'
# delete_keychain(name: keychain_name)
# end
end

# https://github.com/CocoaPods/Xcodeproj/issues/505#issuecomment-584699008
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ async function run() {
process.env.APP_STORE_CONNECT_API_KEY_BASE64 = core.getInput('app-store-connect-api-key-base64');
process.env.BUILD_PATH = core.getInput('build-path');
process.env.CUSTOM_KEYCHAIN_NAME = core.getInput('custom-keychain-name');
process.env.SKIP_KEYCHAIN_DELETION = core.getInput('skip-keychain-deletion');

// Execute build.sh
await exec.exec(`bash ${__dirname}/../build.sh`);
Expand Down

0 comments on commit d7ed4e9

Please sign in to comment.