Class: Fastlane::Actions::UpdateBuildNumberAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::UpdateBuildNumberAction
- Defined in:
- lib/fastlane/plugin/fastci/actions/update_build_number_action.rb
Overview
更新 build 号
Class Method Summary collapse
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .run(params) ⇒ Object
Class Method Details
.available_options ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/fastlane/plugin/fastci/actions/update_build_number_action.rb', line 43 def self. [ FastlaneCore::ConfigItem.new( key: :build, description: "不采取自动更新,自定义 build 号", optional: true, default_value: nil, type: String ), ] end |
.category ⇒ Object
59 60 61 |
# File 'lib/fastlane/plugin/fastci/actions/update_build_number_action.rb', line 59 def self.category :building end |
.description ⇒ Object
39 40 41 |
# File 'lib/fastlane/plugin/fastci/actions/update_build_number_action.rb', line 39 def self.description "更新 build 号" end |
.is_supported?(platform) ⇒ Boolean
55 56 57 |
# File 'lib/fastlane/plugin/fastci/actions/update_build_number_action.rb', line 55 def self.is_supported?(platform) platform == :ios end |
.run(params) ⇒ Object
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 |
# File 'lib/fastlane/plugin/fastci/actions/update_build_number_action.rb', line 8 def self.run(params) build = params[:build] || nil unless CommonHelper.is_validate_string(build) currentTime = Time.new.strftime("%Y%m%d") build = CommonHelper.get_cached_build_number if build.include?("#{currentTime}.") # 当天版本 计算迭代版本号 lastStr = build.split('.').last lastNum = lastStr.to_i lastNum += 1 lastStr = lastNum.to_s.rjust(2, '0') build = "#{currentTime}.#{lastStr}" else # 非当天版本 build 重置 build = "#{currentTime}.01" end # 缓存新的 build 号 CommonHelper.write_cached_txt(Constants.BUILD_NUMBER_FILE, build) end UI.("*************| 更新 build #{build} |*************") # 更改项目 build 号 Actions::IncrementBuildNumberAction.run( build_number: build ) end |