Skip to content

Instantly share code, notes, and snippets.

@acecilia
Last active April 25, 2018 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acecilia/5c7755b7418bb7a6c68affb9f1164dc3 to your computer and use it in GitHub Desktop.
Save acecilia/5c7755b7418bb7a6c68affb9f1164dc3 to your computer and use it in GitHub Desktop.
Fastlane match with keychain removal
# If the match keychain is present, remove it
def remove_keychain_if_exists
delete_keychain(name: <keychainName>) if File.exist? File.expand_path "~/Library/Keychains/#{<keychainName>}-db" # The File.expand_path is crutial, otherwise File.exist? will not work!!!!!!!
end
keychainPassword = SecureRandom.base64(16) # We need a key for the keychain, so nobody can extract the certificates out while the build is happening
remove_keychain_if_exists
create_keychain(
name: <keychainName>,
password: keychainPassword,
unlock: true,
timeout: false
)
match(
username: <username>,
app_identifier: <app_identifier>,
type: <type>,
shallow_clone: true,
clone_branch_directly: true,
verbose: true,
keychain_name: <keychainName>,
keychain_password: keychainPassword
)
gym(
scheme: <schemeName>,
configuration: <conf>,
clean: true,
export_method: <export_method>,
export_team_id: <username>
)
remove_keychain_if_exists
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment