Upgrade to Pro — share decks privately, control downloads, hide ads and more …

詳解Fastfile

giginet
September 01, 2018

 詳解Fastfile

giginet

September 01, 2018
Tweet

More Decks by giginet

Other Decks in Technology

Transcript

  1. private_lane :build_for_appstore do |params| scheme = params[:scheme] build_ios_app(scheme: scheme) end

    lane :release do build_for_appstore(scheme: 'MyApp') end Ҿ਺ ผͷMBOF͔Βݺ΂Δ
  2. scheme 'MyApp' include_bitcode false claen true for_lane :build_for_inhouse do configuration

    'Beta' export_method 'enterprise' end for_lane :build_for_release do configuration 'Release' export_method 'app-store' include_bitcode true end fastlane/Gymfile σϑΥϧτ஋Λઃఆ MBOF͝ͱʹPWFSSJEF
  3. module Fastlane module Actions class GetAnswer < Action def self.run(params)

    42 end def self.description "Answer to the Ultimate Question of Life, the Universe, and Everything" end end end end get_answer_action.rb ΞΫγϣϯ࣮ߦ࣌ͷ ॲཧ
  4. lane generate_certificate |params| do # Split app_identifier app_identifiers = params[:app_identifiers]

    UI.user_error!("app_identifier must be String") unless app_identifier.is_a?(String) app_identifiers = app_identifiers.split(',') # Validate type type = params[:type] UI.user_error!("Type must be development or production") unless %w(development production).include?(type) # Do something... end ܕνΣοΫ͢Δ TQMJU͢Δ UZQF͕ਖ਼͍͔͠ΈΔ
  5. def self.available_options [ FastlaneCore::ConfigItem.new( key: :type, description: "Certificate type to

    generate. (development or production)", optional: false, verify_block: proc do |value| is_valid = %w(development production).include?(value.downcase) UI.user_error!(“type is invalid") unless is_valid end, type: String), FastlaneCore::ConfigItem.new( ɹɹɹɹkey: :app_identifier, ɹɹɹɹshort_option: "-a", ɹɹɹɹdescription: "The bundle identifier(s) of your app (comma- separated)", ɹɹɹɹis_string: false, ɹɹɹɹtype: Array), ] end ΦʔόʔϥΠυ
  6. def self.available_options [ FastlaneCore::ConfigItem.new( key: :type, description: "Certificate type to

    generate. (development or production)", optional: false, verify_block: proc do |value| is_valid = %w(development production).include?(value.downcase) UI.user_error!(“type is invalid") unless is_valid end, type: String), FastlaneCore::ConfigItem.new( ɹɹɹɹkey: :app_identifiers, ɹɹɹɹshort_option: "-a", ɹɹɹɹdescription: "The bundle identifier(s) of your app (comma- separated)", ɹɹɹɹis_string: false, ɹɹɹɹtype: Array), ] end ΦʔόʔϥΠυ
  7. XcodeͷઃఆΛ׆༻͢Δ • ྫ͑͹഑෍༻ͱࣾ಺Ϗϧυ༻ͳͲͰϏϧυ؀ڥΛෳ਺؅ ཧ͍ͨ͠ #VJME $POpHVSBUJPO %FWFMPQFS 5FBN "QQ*EFOUJpFS $PEF4JHOJOH

    4UZMF %FCVH 0SHBOJ[BUJPO DPNDPPLQBEOFX BQQ "VUPNBUJD 3FMFBTF 0SHBOJ[BUJPO DPNDPPLQBEOFX BQQ .BOVBM #FUB &OUFSQSJTF DPNDPPLQBEOF XBQQJOIPVTF .BOVBM
  8. XcodeͷઃఆΛ׆༻͢Δ • FastfileͰApp Identifier΍Code Signing StyleΛॻ͖ ׵͑ • update_app_identifier •

    update_project_team • automatic_code_signing • update_project_provisioning
  9. # Provisioning Profileͷऔಘ match(git_branch: "enterprise", type: 'enterprise', readonly: true, app_identifier:

    'com.cookpad.myapp-beta') provisioning_profile_specifier = ENV["sigh_com.cookpad.myapp-beta_appstore_profile-name"] provisioning_profile_path = ENV["sigh_com.cookpad.myapp- beta_appstore_profile-path"] team_id = ENV["sigh_com.cookpad.myapp-beta_appstore_team- id"] NBUDIͰ1SPWJTJPOJOH1SPpMFΛऔಘ 1SPWJTJPOJOH1SPpMFͷ1BUI΍໊લΛऔಘ
  10. # Team IDͷߋ৽ update_project_team( teamid: team_id, ) # Automatic Code

    SigningͷແޮԽ disable_automatic_code_signing( team_id: team_id, profile_name: provisioning_profile_specifier, code_sign_identity: 'iPhone Distribution', targets: %w(MyApp), ) # Provisioning Profileͷઃఆ update_project_provisioning( profile: provisioning_profile_path, target_filter: 'MyApp', )
  11. lane :build_for_inhouse # Provisioning Profileͷऔಘ match(git_branch: "enterprise", type: 'enterprise', readonly:

    true, app_identifier: 'com.cookpad.myapp-beta') provisioning_profile_specifier = ENV["sigh_com.cookpad.myapp-beta_appstore_profile-name"] provisioning_profile_path = ENV["sigh_com.cookpad.myapp-beta_appstore_profile-path"] team_id = ENV["sigh_com.cookpad.myapp-beta_appstore_team-id"] # Team IDͷߋ৽ update_project_team( teamid: team_id, ) # Automatic Code SigningͷແޮԽ disable_automatic_code_signing( team_id: team_id, profile_name: provisioning_profile_specifier, code_sign_identity: 'iPhone Distribution', targets: %w(MyApp), ) # Provisioning Profileͷઃఆ update_project_provisioning( profile: provisioning_profile_path, target_filter: 'MyApp', ) # App Identifierͷߋ৽ update_app_identifier( app_identifier: 'com.cookpad.myapp-beta', ) build_ios_app(scheme: 'MyApp-Beta', export_method: 'enterprise') end
  12. lane :build_for_inhouse # Provisioning Profileͷऔಘ match(git_branch: "enterprise", type: 'enterprise', readonly:

    true, app_identifier: 'com.cookpad.myapp-beta') provisioning_profile_specifier = ENV["sigh_com.cookpad.myapp-beta_appstore_profile-name"] provisioning_profile_path = ENV["sigh_com.cookpad.myapp-beta_appstore_profile-path"] team_id = ENV["sigh_com.cookpad.myapp-beta_appstore_team-id"] # Team IDͷߋ৽ update_project_team( teamid: team_id, ) # Automatic Code SigningͷແޮԽ disable_automatic_code_signing( team_id: team_id, profile_name: provisioning_profile_specifier, code_sign_identity: 'iPhone Distribution', targets: %w(MyApp), ) # Provisioning Profileͷઃఆ update_project_provisioning( profile: provisioning_profile_path, target_filter: 'MyApp', ) # App Identifierͷߋ৽ update_app_identifier( app_identifier: 'com.cookpad.myapp-beta', ) build_ios_app(scheme: 'MyApp-Beta', export_method: 'enterprise') end
  13. #VJME $POpHVSBU JPO %FWFMPQF S5FBN 1SPEVDU #VOEMF *EFOUJpFS $PEF 4JHOJOH

    4UZMF 1SPEVDU #VOEMF *EFOUJUZ 1SPWJTJPOJOH 1SPpMF %FCVH 0SHBOJ[BUJ PO DPNDPPLQBE OFXBQQ "VUPNBUJD J04 %FWFMPQFS "VUPNBUJD 3FMFBTF 0SHBOJ[BUJ PO DPNDPPLQBE OFXBQQ .BOVBM J04 %JTUSJCVUJPO NBUDI "QQ4UPSF DPNDPPLQBE OFXBQQ #FUB &OUFSQSJTF DPNDPPLQBE OFXBQQ JOIPVTF .BOVBM J04 %JTUSJCVJUJPO NBUDI *O)PVTF DPNDPPLQBE OFXBQQCFUB
  14. lane :build_for_appstore do # Provisioning Profileͷऔಘ(match) app_identifiers = %w(com.cookpad.myapp com.cookpad.myapp.NotificationService)

    match(type: 'appstore', readonly: true, app_identifier: app_identifiers) # Ϗϧυ gym(scheme: 'MyApp', configuration: 'Release', export_method: 'app-store') end
  15. # vim: syntax=ruby require_fastlane 'pry' lane :release do |params| binding.pry

    scheme = params[:scheme] build_for_appstore end SFRVJSFͱಉ͡ #SFBLQPJOU