Fastfile

Description

The Fastfile is used to configure fastlaneopen in new window. Open it in your favourite text editor, using Ruby syntax highlighting.

Example

default_platform :ios

@app_name = "Fitcheck"
@app_id = ""
@cert_id = "82BQ7LUV44"
@team_id = "1650480"
@bundle_id = "com.fitcheckapp.ios"
@scheme = "Fitcheck"
@servers_envs = ['production', 'development', 'staging']

import_from_git(
  url: "git@git.themindstudios.com:ios/fastlane_configurations.git"
)

platform :ios do

  before_all do

    if is_ci

      setup_deployment(
        google_drive_certificate_subpath: "FitCheck/FitCheck_Distribution.p12"
      )

      cocoapods(
        repo_update: true
      )
    end

  end

  lane :deploy_to_testflight do |options|

    server_env = options[:server_env]

    if server_env != nil

      switch_env(
        server_env: server_env
      )
    end

    sign(
      adhoc: false
    )

    build(
      app_store: true, 
      app_name: @app_name,
      scheme: @scheme
    )

    deliver_to_testflight
    deliver_to_crashlytics

    commit_and_push_version

    get_build_number
    get_version_number

    version_number =  lane_context[SharedValues::VERSION_NUMBER]
    build_number =    lane_context[SharedValues::BUILD_NUMBER]

    add_git_tag(
      tag: "#{version_number}_(#{build_number})"
    )

    push_git_tags

  end

  lane :deploy_to_crashlytics do |options|

    server_env = options[:server_env]

    if server_env != nil

      switch_env(
        server_env: server_env
      )
    end

    sign(
      adhoc: true
    )

    build(
      app_store: false,
      app_name: @app_name,
      scheme: @scheme,
      clean: false,
      build_number_additional_string: "#{server_env}",
      should_add_badge: true
    )

    deliver_to_crashlytics

    commit_and_push_version

  end

  lane :analyze_app_build_time do |options|

    scheme = options[:scheme] || @scheme
    xcworkspace_name = options[:xcworkspace_name] || @scheme
    
    sh "cd .. && xcodebuild -workspace #{xcworkspace_name}.xcworkspace -scheme #{scheme} clean build OTHER_SWIFT_FLAGS=\"-Xfrontend -debug-time-function-bodies\" | grep .[0-9]ms | grep -v ^0.[0-9]ms | sort -nr > culprits.txt"

  end

  after_all do |lane|

  end

  error do |lane, exception|

  end
end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118

Parameters

variableDescription
@app_nameThe name of your App.
@app_idThe ID of your App.
@cert_idThe ID of the code signing certificate to use (e.g. SWU45WHDKC for ManyPeople)
@team_idThe ID of your Developer Portal team if you're in multiple teams (e.g. 1650480 for ManyPeople).
@bundle_idThe bundle ID of your App.
@schemeThe scheme of your App.
@servers_envsopen in new windowserver environment of your build (production, development, staging).

Lane Parameters

laneDescription
before_allThis block will get executed before running the requested lane. It supports the same actions as lanes.
after_allThis block will get executed after running the requested lane. It supports the same actions as lanes.
errorThis block will get executed when an error occurs, in any of the blocks (before_all, the lane itself or after_all).