From 4ab29f10bb63522590d3958780ec4b0ac3aa4baa Mon Sep 17 00:00:00 2001 From: csethanhcong Date: Thu, 28 Sep 2023 16:14:46 +0700 Subject: [PATCH] Allow force set version_code if specified --- .../actions/increment_version_code_action.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/fastlane/plugin/increment_version_code/actions/increment_version_code_action.rb b/lib/fastlane/plugin/increment_version_code/actions/increment_version_code_action.rb index 081f1bb..ce36382 100644 --- a/lib/fastlane/plugin/increment_version_code/actions/increment_version_code_action.rb +++ b/lib/fastlane/plugin/increment_version_code/actions/increment_version_code_action.rb @@ -9,6 +9,13 @@ def self.run(params) version_code = "0" new_version_code ||= params[:version_code] + # If version_code is set, ignore the process + if new_version_code != nil + # Store the version name in the shared hash + Actions.lane_context["VERSION_CODE"]=new_version_code.to_i + UI.success("VERSION_CODE will be forced set to #{new_version_code}") + UI.success("☝️ Version code has been changed to #{new_version_code}") + constant_name ||= params[:ext_constant_name] gradle_file_path ||= params[:gradle_file_path] @@ -102,7 +109,7 @@ def self.available_options default_value: nil), FastlaneCore::ConfigItem.new(key: :version_code, env_name: "INCREMENTVERSIONCODE_VERSION_CODE", - description: "Change to a specific version (optional)", + description: "Force change to a specific version (optional)", optional: true, type: Integer, default_value: 0),