1+ # Customise this file, documentation can be found here:
2+ # https://docs.fastlane.tools/actions/
3+ # All available actions: https://docs.fastlane.tools/actions
4+ # can also be listed using the `fastlane actions` command
5+
6+ # Change the syntax highlighting to Ruby
7+ # All lines starting with a # are ignored when running `fastlane`
8+
9+ # If you want to automatically update fastlane if a new version is available:
10+ # update_fastlane
11+
12+ # This is the minimum version number required.
13+ # Update this, if you use features of a newer version
14+ fastlane_version "2.58.0"
15+
16+ default_platform :ios
17+
18+ platform :ios do
19+
20+ workspace_file = '___PACKAGENAME___.xcworkspace'
21+ project_file = '___PACKAGENAME___.xcodeproj'
22+ main_scheme = '___PACKAGENAME___'
23+ bundle_name = "___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___"
24+
25+ before_all do |lane , options |
26+ # ensure_git_status_clean
27+ end
28+
29+ lane :build do |options |
30+ sigh (
31+ development : true ,
32+ app_identifier : bundle_name
33+ )
34+
35+ xcodebuild (
36+ workspace : workspace_file ,
37+ scheme : main_scheme ,
38+ configuration : "Debug" ,
39+ clean : options [ :clean ] ,
40+ build : true ,
41+ destination : "generic/platform=iOS\" CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY=\" "
42+ )
43+ end
44+
45+ lane :prepare_for_integration do |options |
46+
47+ version_number = options [ :version_number ]
48+ if version_number . nil?
49+ throw "Required version_number parameter"
50+ end
51+
52+ build_number = options [ :type_v ]
53+ if not build_number . nil?
54+ increment_build_number ( build_number : build_number )
55+ else
56+ increment_build_number ( )
57+ end
58+
59+ increment_version_number ( version_number : options [ :version_number ] )
60+
61+ commit_version_bump (
62+ xcodeproj : project_file ,
63+ force : true
64+ )
65+
66+ tag_label = get_version_number
67+
68+ type = options [ :type ]
69+ typeIndex = options [ :type_v ]
70+ if not type . nil?
71+ tag_label = "dev_" + tag_label + "-" + type + "" + typeIndex
72+ end
73+
74+ add_git_tag (
75+ tag : tag_label
76+ )
77+
78+ # sh("git push && git push origin --tags")
79+ end
80+
81+ desc "Set build number and push version bump commit to develop branch with tag"
82+ lane :prepare_for_beta do |options |
83+
84+ current_version = get_version_number
85+ type = options [ :type ]
86+ tag_prefix = 'dev_' + current_version + "-" + type
87+
88+ last_tag = git_tags
89+ . select { |tag | tag . index ( tag_prefix ) == 0 }
90+ . first
91+
92+ if last_tag . nil?
93+ last_tag_index = 0
94+ else
95+ last_tag_index = ( last_tag . sub! tag_prefix , "" ) . to_i
96+ end
97+
98+ result_tag_index = last_tag_index + 1
99+ build_number = tag_prefix + result_tag_index . to_s
100+
101+ prepare_for_integration (
102+ version_number : current_version ,
103+ type : options [ :type ] ,
104+ type_v : result_tag_index . to_s ,
105+ build_number : build_number
106+ )
107+ end
108+
109+ desc "Set version and build numbers and push version bump commit to master branch with tag"
110+ lane :prepare_for_release do |options |
111+ release_build_number = app_store_build_number . to_i + 1
112+ prepare_for_integration ( version_number : options [ :version_number ] , build_number : release_build_number )
113+ end
114+
115+ desc "Submit a new Beta Build to Fabric"
116+ lane :beta do
117+
118+ cocoapods ( use_bundle_exec :true )
119+
120+ sigh (
121+ development : true ,
122+ app_identifier : bundle_name
123+ )
124+
125+ gym (
126+ scheme : main_scheme ,
127+ configuration : "Debug" ,
128+ clean : true ,
129+ include_bitcode : false ,
130+ export_options : { compileBitcode : false } ,
131+ export_method : "development"
132+ )
133+
134+ upload_to_fabric
135+
136+ sh ( "rm ../*.mobileprovision" )
137+ end
138+
139+ # Need check
140+ desc "Submit a new Release Build to Fabric"
141+ lane :release do
142+ #cocoapods(use_bundle_exec: false)
143+
144+ cert ( development : false )
145+
146+ sigh (
147+ development : true ,
148+ app_identifier : bundle_name
149+ )
150+
151+ gym (
152+ scheme : main_scheme ,
153+ configuration : "Release" ,
154+ clean : true ,
155+ include_bitcode : false ,
156+ export_options : { compileBitcode : false } ,
157+ export_method : "app-store"
158+ )
159+
160+ upload_to_fabric
161+
162+ sh ( "rm ../*.mobileprovision" )
163+ end
164+
165+ lane :upload_to_fabric do
166+
167+ # Load in Fabric
168+ crashlytics (
169+ api_token : "PUT TOKEN HERE" ,
170+ build_secret : "PUT BUILD SECRET HERE" ,
171+ emails : [ "PUT_EMAILS_HERE" ] ,
172+ notes : ENV [ main_scheme + "_iOS_Crashlytics_Changelog" ]
173+ )
174+ end
175+
176+ end
177+
178+
179+ # More information about multiple platforms in fastlane: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
180+ # All available actions: https://docs.fastlane.tools/actions
181+
182+ # fastlane reports which actions are used. No personal data is recorded.
183+ # Learn more at https://github.com/fastlane/fastlane#metrics
0 commit comments