Class: Fastlane::Actions::IncrementBuildNumberAction
Class Method Summary
collapse
action_name, authors, details, return_value, sh, step_text
Class Method Details
.author ⇒ Object
76
77
78
|
# File 'lib/fastlane/actions/increment_build_number.rb', line 76
def self.author
"KrauseFx"
end
|
.available_options ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/fastlane/actions/increment_build_number.rb', line 52
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :build_number,
env_name: "FL_BUILD_NUMBER_BUILD_NUMBER",
description: "Change to a specific version",
optional: true,
is_string: false),
FastlaneCore::ConfigItem.new(key: :xcodeproj,
env_name: "FL_BUILD_NUMBER_PROJECT",
description: "optional, you must specify the path to your main Xcode project if it is not in the project root directory",
optional: true,
verify_block: proc do |value|
raise "Please pass the path to the project, not the workspace".red if value.end_with? ".xcworkspace"
raise "Could not find Xcode project".red if !File.exist?(value) and !Helper.is_test?
end)
]
end
|
.description ⇒ Object
48
49
50
|
# File 'lib/fastlane/actions/increment_build_number.rb', line 48
def self.description
"Increment the build number of your project"
end
|
.is_supported?(platform) ⇒ Boolean
10
11
12
|
# File 'lib/fastlane/actions/increment_build_number.rb', line 10
def self.is_supported?(platform)
[:ios, :mac].include? platform
end
|
.output ⇒ Object
70
71
72
73
74
|
# File 'lib/fastlane/actions/increment_build_number.rb', line 70
def self.output
[
['BUILD_NUMBER', 'The new build number']
]
end
|
.run(params) ⇒ Object
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
|
# File 'lib/fastlane/actions/increment_build_number.rb', line 14
def self.run(params)
folder = params[:xcodeproj] ? File.join(params[:xcodeproj], '..') : '.'
command_prefix = [
'cd',
File.expand_path(folder).shellescape,
'&&'
].join(' ')
command = [
command_prefix,
'agvtool',
params[:build_number] ? "new-version -all #{params[:build_number]}" : 'next-version -all'
].join(' ')
if Helper.test?
Actions.lane_context[SharedValues::BUILD_NUMBER] = command
else
Actions.sh command
build_number = `#{command_prefix} agvtool what-version`.split("\n").last.strip
Actions.lane_context[SharedValues::BUILD_NUMBER] = build_number
end
rescue => ex
Helper.log.error 'Make sure to follow the steps to setup your Xcode project: https://developer.apple.com/library/ios/qa/qa1827/_index.html'.yellow
raise ex
end
|