# This file contains the fastlane.tools configuration # You can find the documentation at https://docs.fastlane.tools # # For a list of all available actions, check out # # https://docs.fastlane.tools/actions # # For a list of all available plugins, check out # # https://docs.fastlane.tools/plugins/available-plugins # # Uncomment the line if you want fastlane to automatically update itself # update_fastlane default_platform(:ios) platform :ios do before_all do setup_circle_ci app_store_api_key end desc "Get the app store connect api key from the auth key" private_lane :app_store_api_key do key = app_store_connect_api_key( key_id: ENV["APP_STORE_CONNECT_KEY_ID"], issuer_id: ENV["APP_STORE_CONNECT_ISSUER_ID"], key_content: ENV["APP_STORE_CONNECT_API_KEY_BASE64"], is_key_content_base64: true, in_house: false ) key end devices = { # Add your devices that you wish to register here - See https://docs.fastlane.tools/actions/register_devices/ } desc "Download all certificates" lane :certificates do develop_certificates appstore_certificates end desc "Download or regenerate(with option) development and adhoc match certificates for ios signing" lane :develop_certificates do |options| readonly = options.fetch(:readonly, true) match(readonly: readonly) match(type: "adhoc", readonly: readonly) end desc "Download or regenerate(with option) appstore certificates for ios signing" lane :appstore_certificates do |options| readonly = options.fetch(:readonly, true) match(type: "appstore", readonly: readonly) end desc "Register new devices" lane :register_new_devices do register_devices(devices: devices) certificates end desc "iOS build" lane :build do |options| build_config = options.fetch(:build_config, "Release") match(type: "appstore", app_identifier: "{{ appIdentifier }}") package = load_json(json_path: "../package.json") build_number = latest_testflight_build_number( app_identifier: "{{ appIdentifier }}", initial_build_number: 0, ) + 1 version_number = package["version"] || "0.1.#{build_number}" increment_build_number(build_number: build_number) increment_version_number(version_number: version_number) build_app( scheme: "{{ projectName }}", configuration: build_config, export_options: { method: "appstore", provisioningProfiles: { "{{ appIdentifier }}" => "match AppStore {{ appIdentifier }}" } } ) version_number end desc "iOS testflight deploy" lane :testflight_deploy do version_number = build(build_config: "{{ testFlightBuildConfiguration }}") upload_to_testflight(app_identifier: "{{ appIdentifier }}") slack( message: "New Beta build(#{version_number}) available on testflight" ) end desc "iOS production deploy" lane :production_deploy do version_number = build deliver( submit_for_review: false, force: true, skip_metadata: true, skip_screenshots: true ) slack( message: "New Release build(#{version_number}) can be submitted for review on app store connect" ) end error do |lane, exception| slack( message: "An error has occurred", success: false, attachment_properties: { fields: [{ title: "Details", value: exception.to_s, }] }, payload: { "Output" => exception.error_info.to_s } ) end end