fastlane-plugin-wpmreleasetoolkit 9.1.0 → 9.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb +48 -5
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_prechecks.rb +41 -6
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_beta.rb +45 -5
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_final_release.rb +45 -5
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_hotfix.rb +39 -3
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_release.rb +48 -5
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_codefreeze_prechecks.rb +38 -3
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_completecodefreeze_prechecks.rb +28 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_current_branch_is_hotfix.rb +31 -2
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb +13 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_translations_action.rb +3 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb +28 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_alpha_version.rb +31 -2
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_app_version.rb +31 -2
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_release_version.rb +31 -2
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_tag_build.rb +33 -2
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_release_notes.rb +2 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_release_notes.rb +2 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_git_helper.rb +8 -9
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb +36 -50
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/deprecated.rb +66 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/abstract_version_calculator.rb +10 -0
- metadata +9 -2
data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_translations_action.rb
CHANGED
@@ -7,7 +7,8 @@ module Fastlane
|
|
7
7
|
require_relative '../../helper/android/android_localize_helper'
|
8
8
|
require_relative '../../helper/git_helper'
|
9
9
|
|
10
|
-
|
10
|
+
project_root_folder = params[:project_root_folder]
|
11
|
+
res_dir = File.join(project_root_folder || '.', params[:res_dir])
|
11
12
|
|
12
13
|
Fastlane::Helper::Android::LocalizeHelper.create_available_languages_file(
|
13
14
|
res_dir: res_dir,
|
@@ -94,6 +95,7 @@ module Fastlane
|
|
94
95
|
type: Boolean,
|
95
96
|
default_value: false
|
96
97
|
),
|
98
|
+
Fastlane::Helper::Deprecated.project_root_folder_config_item,
|
97
99
|
]
|
98
100
|
end
|
99
101
|
|
@@ -15,7 +15,17 @@ module Fastlane
|
|
15
15
|
current_branch = Fastlane::Helper::GitHelper.current_git_branch
|
16
16
|
UI.user_error!("Current branch - '#{current_branch}' - is not a release branch. Abort.") unless current_branch.start_with?('release/')
|
17
17
|
|
18
|
-
|
18
|
+
has_alpha_version = params[:has_alpha_version]
|
19
|
+
project_root_folder = params[:project_root_folder]
|
20
|
+
project_name = params[:project_name]
|
21
|
+
build_gradle_path = params[:build_gradle_path] || (File.join(project_root_folder || '.', project_name, 'build.gradle') unless project_name.nil?)
|
22
|
+
version_properties_path = params[:version_properties_path] || File.join(project_root_folder || '.', 'version.properties')
|
23
|
+
|
24
|
+
version = Fastlane::Helper::Android::VersionHelper.get_public_version(
|
25
|
+
build_gradle_path: build_gradle_path,
|
26
|
+
version_properties_path: version_properties_path,
|
27
|
+
has_alpha_version: has_alpha_version
|
28
|
+
)
|
19
29
|
message = "Finalizing release: #{version}\n"
|
20
30
|
if params[:skip_confirm]
|
21
31
|
UI.message(message)
|
@@ -51,6 +61,23 @@ module Fastlane
|
|
51
61
|
description: 'Skips confirmation',
|
52
62
|
type: Boolean,
|
53
63
|
default_value: false), # the default value if the user didn't provide one
|
64
|
+
FastlaneCore::ConfigItem.new(key: :build_gradle_path,
|
65
|
+
description: 'Path to the build.gradle file',
|
66
|
+
type: String,
|
67
|
+
optional: true,
|
68
|
+
conflicting_options: %i[project_name
|
69
|
+
project_root_folder
|
70
|
+
version_properties_path]),
|
71
|
+
FastlaneCore::ConfigItem.new(key: :version_properties_path,
|
72
|
+
description: 'Path to the version.properties file',
|
73
|
+
type: String,
|
74
|
+
optional: true,
|
75
|
+
conflicting_options: %i[build_gradle_path
|
76
|
+
project_name
|
77
|
+
project_root_folder]),
|
78
|
+
Fastlane::Helper::Deprecated.project_root_folder_config_item,
|
79
|
+
Fastlane::Helper::Deprecated.project_name_config_item,
|
80
|
+
Fastlane::Helper::Deprecated.has_alpha_version_config_item,
|
54
81
|
]
|
55
82
|
end
|
56
83
|
|
@@ -3,7 +3,18 @@ module Fastlane
|
|
3
3
|
class AndroidGetAlphaVersionAction < Action
|
4
4
|
def self.run(params)
|
5
5
|
require_relative '../../helper/android/android_version_helper'
|
6
|
-
|
6
|
+
|
7
|
+
has_alpha_version = params[:has_alpha_version]
|
8
|
+
project_root_folder = params[:project_root_folder]
|
9
|
+
project_name = params[:project_name]
|
10
|
+
build_gradle_path = params[:build_gradle_path] || (File.join(project_root_folder || '.', project_name, 'build.gradle') unless project_name.nil?)
|
11
|
+
version_properties_path = params[:version_properties_path] || File.join(project_root_folder || '.', 'version.properties')
|
12
|
+
|
13
|
+
Fastlane::Helper::Android::VersionHelper.get_alpha_version(
|
14
|
+
build_gradle_path: build_gradle_path,
|
15
|
+
version_properties_path: version_properties_path,
|
16
|
+
has_alpha_version: has_alpha_version
|
17
|
+
)
|
7
18
|
end
|
8
19
|
|
9
20
|
#####################################################
|
@@ -19,7 +30,25 @@ module Fastlane
|
|
19
30
|
end
|
20
31
|
|
21
32
|
def self.available_options
|
22
|
-
|
33
|
+
[
|
34
|
+
FastlaneCore::ConfigItem.new(key: :build_gradle_path,
|
35
|
+
description: 'Path to the build.gradle file',
|
36
|
+
type: String,
|
37
|
+
optional: true,
|
38
|
+
conflicting_options: %i[project_name
|
39
|
+
project_root_folder
|
40
|
+
version_properties_path]),
|
41
|
+
FastlaneCore::ConfigItem.new(key: :version_properties_path,
|
42
|
+
description: 'Path to the version.properties file',
|
43
|
+
type: String,
|
44
|
+
optional: true,
|
45
|
+
conflicting_options: %i[build_gradle_path
|
46
|
+
project_name
|
47
|
+
project_root_folder]),
|
48
|
+
Fastlane::Helper::Deprecated.project_root_folder_config_item,
|
49
|
+
Fastlane::Helper::Deprecated.project_name_config_item,
|
50
|
+
Fastlane::Helper::Deprecated.has_alpha_version_config_item,
|
51
|
+
]
|
23
52
|
end
|
24
53
|
|
25
54
|
def self.output
|
@@ -3,7 +3,18 @@ module Fastlane
|
|
3
3
|
class AndroidGetAppVersionAction < Action
|
4
4
|
def self.run(params)
|
5
5
|
require_relative '../../helper/android/android_version_helper'
|
6
|
-
|
6
|
+
|
7
|
+
has_alpha_version = params[:has_alpha_version]
|
8
|
+
project_root_folder = params[:project_root_folder]
|
9
|
+
project_name = params[:project_name]
|
10
|
+
build_gradle_path = params[:build_gradle_path] || (File.join(project_root_folder || '.', project_name, 'build.gradle') unless project_name.nil?)
|
11
|
+
version_properties_path = params[:version_properties_path] || File.join(project_root_folder || '.', 'version.properties')
|
12
|
+
|
13
|
+
Fastlane::Helper::Android::VersionHelper.get_public_version(
|
14
|
+
build_gradle_path: build_gradle_path,
|
15
|
+
version_properties_path: version_properties_path,
|
16
|
+
has_alpha_version: has_alpha_version
|
17
|
+
)
|
7
18
|
end
|
8
19
|
|
9
20
|
#####################################################
|
@@ -19,7 +30,25 @@ module Fastlane
|
|
19
30
|
end
|
20
31
|
|
21
32
|
def self.available_options
|
22
|
-
|
33
|
+
[
|
34
|
+
FastlaneCore::ConfigItem.new(key: :build_gradle_path,
|
35
|
+
description: 'Path to the build.gradle file',
|
36
|
+
type: String,
|
37
|
+
optional: true,
|
38
|
+
conflicting_options: %i[project_name
|
39
|
+
project_root_folder
|
40
|
+
version_properties_path]),
|
41
|
+
FastlaneCore::ConfigItem.new(key: :version_properties_path,
|
42
|
+
description: 'Path to the version.properties file',
|
43
|
+
type: String,
|
44
|
+
optional: true,
|
45
|
+
conflicting_options: %i[build_gradle_path
|
46
|
+
project_name
|
47
|
+
project_root_folder]),
|
48
|
+
Fastlane::Helper::Deprecated.project_root_folder_config_item,
|
49
|
+
Fastlane::Helper::Deprecated.project_name_config_item,
|
50
|
+
Fastlane::Helper::Deprecated.has_alpha_version_config_item,
|
51
|
+
]
|
23
52
|
end
|
24
53
|
|
25
54
|
def self.output
|
@@ -3,7 +3,18 @@ module Fastlane
|
|
3
3
|
class AndroidGetReleaseVersionAction < Action
|
4
4
|
def self.run(params)
|
5
5
|
require_relative '../../helper/android/android_version_helper'
|
6
|
-
|
6
|
+
|
7
|
+
has_alpha_version = params[:has_alpha_version]
|
8
|
+
project_root_folder = params[:project_root_folder]
|
9
|
+
project_name = params[:project_name]
|
10
|
+
build_gradle_path = params[:build_gradle_path] || (File.join(project_root_folder || '.', project_name, 'build.gradle') unless project_name.nil?)
|
11
|
+
version_properties_path = params[:version_properties_path] || File.join(project_root_folder || '.', 'version.properties')
|
12
|
+
|
13
|
+
Fastlane::Helper::Android::VersionHelper.get_release_version(
|
14
|
+
build_gradle_path: build_gradle_path,
|
15
|
+
version_properties_path: version_properties_path,
|
16
|
+
has_alpha_version: has_alpha_version
|
17
|
+
)
|
7
18
|
end
|
8
19
|
|
9
20
|
#####################################################
|
@@ -19,7 +30,25 @@ module Fastlane
|
|
19
30
|
end
|
20
31
|
|
21
32
|
def self.available_options
|
22
|
-
|
33
|
+
[
|
34
|
+
FastlaneCore::ConfigItem.new(key: :build_gradle_path,
|
35
|
+
description: 'Path to the build.gradle file',
|
36
|
+
type: String,
|
37
|
+
optional: true,
|
38
|
+
conflicting_options: %i[project_name
|
39
|
+
project_root_folder
|
40
|
+
version_properties_path]),
|
41
|
+
FastlaneCore::ConfigItem.new(key: :version_properties_path,
|
42
|
+
description: 'Path to the version.properties file',
|
43
|
+
type: String,
|
44
|
+
optional: true,
|
45
|
+
conflicting_options: %i[build_gradle_path
|
46
|
+
project_name
|
47
|
+
project_root_folder]),
|
48
|
+
Fastlane::Helper::Deprecated.project_root_folder_config_item,
|
49
|
+
Fastlane::Helper::Deprecated.project_name_config_item,
|
50
|
+
Fastlane::Helper::Deprecated.has_alpha_version_config_item,
|
51
|
+
]
|
23
52
|
end
|
24
53
|
|
25
54
|
def self.output
|
@@ -5,8 +5,22 @@ module Fastlane
|
|
5
5
|
require_relative '../../helper/android/android_version_helper'
|
6
6
|
require_relative '../../helper/android/android_git_helper'
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
has_alpha_version = params[:has_alpha_version]
|
9
|
+
project_root_folder = params[:project_root_folder]
|
10
|
+
project_name = params[:project_name]
|
11
|
+
build_gradle_path = params[:build_gradle_path] || (File.join(project_root_folder || '.', project_name, 'build.gradle') unless project_name.nil?)
|
12
|
+
version_properties_path = params[:version_properties_path] || File.join(project_root_folder || '.', 'version.properties')
|
13
|
+
|
14
|
+
release_ver = Fastlane::Helper::Android::VersionHelper.get_release_version(
|
15
|
+
build_gradle_path: build_gradle_path,
|
16
|
+
version_properties_path: version_properties_path,
|
17
|
+
has_alpha_version: has_alpha_version
|
18
|
+
)
|
19
|
+
alpha_ver = Fastlane::Helper::Android::VersionHelper.get_alpha_version(
|
20
|
+
build_gradle_path: build_gradle_path,
|
21
|
+
version_properties_path: version_properties_path,
|
22
|
+
has_alpha_version: has_alpha_version
|
23
|
+
)
|
10
24
|
Fastlane::Helper::GitHelper.create_tag(release_ver[Fastlane::Helper::Android::VersionHelper::VERSION_NAME])
|
11
25
|
Fastlane::Helper::GitHelper.create_tag(alpha_ver[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]) unless alpha_ver.nil? || (params[:tag_alpha] == false)
|
12
26
|
end
|
@@ -30,6 +44,23 @@ module Fastlane
|
|
30
44
|
description: 'True to skip tagging the alpha version',
|
31
45
|
type: Boolean,
|
32
46
|
default_value: true),
|
47
|
+
FastlaneCore::ConfigItem.new(key: :build_gradle_path,
|
48
|
+
description: 'Path to the build.gradle file',
|
49
|
+
type: String,
|
50
|
+
optional: true,
|
51
|
+
conflicting_options: %i[project_name
|
52
|
+
project_root_folder
|
53
|
+
version_properties_path]),
|
54
|
+
FastlaneCore::ConfigItem.new(key: :version_properties_path,
|
55
|
+
description: 'Path to the version.properties file',
|
56
|
+
type: String,
|
57
|
+
optional: true,
|
58
|
+
conflicting_options: %i[build_gradle_path
|
59
|
+
project_name
|
60
|
+
project_root_folder]),
|
61
|
+
Fastlane::Helper::Deprecated.project_root_folder_config_item,
|
62
|
+
Fastlane::Helper::Deprecated.project_name_config_item,
|
63
|
+
Fastlane::Helper::Deprecated.has_alpha_version_config_item,
|
33
64
|
]
|
34
65
|
end
|
35
66
|
|
@@ -8,6 +8,8 @@ module Fastlane
|
|
8
8
|
require_relative '../../helper/release_notes_helper'
|
9
9
|
require_relative '../../helper/git_helper'
|
10
10
|
|
11
|
+
UI.deprecated('The `PROJECT_ROOT_FOLDER` environment variable is deprecated and will be removed in a future release. Please pass a path to the `release_notes_file_path` param instead.') unless ENV['PROJECT_ROOT_FOLDER'].nil?
|
12
|
+
|
11
13
|
path = params[:release_notes_file_path]
|
12
14
|
next_version = Fastlane::Helper::Android::VersionHelper.calc_next_release_short_version(params[:new_version])
|
13
15
|
|
@@ -8,6 +8,8 @@ module Fastlane
|
|
8
8
|
require_relative '../../helper/release_notes_helper'
|
9
9
|
require_relative '../../helper/git_helper'
|
10
10
|
|
11
|
+
UI.deprecated('The `PROJECT_ROOT_FOLDER` environment variable is deprecated and will be removed in a future release. Please pass a path to the `release_notes_file_path` param instead.') unless ENV['PROJECT_ROOT_FOLDER'].nil?
|
12
|
+
|
11
13
|
path = params[:release_notes_file_path]
|
12
14
|
next_version = Fastlane::Helper::Ios::VersionHelper.calc_next_release_version(params[:new_version])
|
13
15
|
|
@@ -12,17 +12,16 @@ module Fastlane
|
|
12
12
|
# @env PROJECT_ROOT_FOLDER The path to the git root of the project
|
13
13
|
# @env PROJECT_NAME The name of the directory containing the project code (especially containing the `build.gradle` file)
|
14
14
|
#
|
15
|
-
def self.commit_version_bump
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
message: 'Bump version number'
|
20
|
-
files: File.join(ENV['PROJECT_ROOT_FOLDER'], 'version.properties')
|
15
|
+
def self.commit_version_bump(build_gradle_path:, version_properties_path:)
|
16
|
+
if File.exist?(version_properties_path)
|
17
|
+
git_commit(
|
18
|
+
path: version_properties_path,
|
19
|
+
message: 'Bump version number'
|
21
20
|
)
|
22
21
|
else
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
git_commit(
|
23
|
+
path: build_gradle_path,
|
24
|
+
message: 'Bump version number'
|
26
25
|
)
|
27
26
|
end
|
28
27
|
end
|
@@ -30,8 +30,12 @@ module Fastlane
|
|
30
30
|
# - If this version is a hotfix (more than 2 parts and 3rd part is non-zero), returns the "X.Y.Z" formatted string
|
31
31
|
# - Otherwise (not a hotfix / 3rd part of version is 0), returns "X.Y" formatted version number
|
32
32
|
#
|
33
|
-
def self.get_public_version
|
34
|
-
version = get_release_version
|
33
|
+
def self.get_public_version(build_gradle_path:, version_properties_path:, has_alpha_version:)
|
34
|
+
version = get_release_version(
|
35
|
+
build_gradle_path: build_gradle_path,
|
36
|
+
version_properties_path: version_properties_path,
|
37
|
+
has_alpha_version: has_alpha_version
|
38
|
+
)
|
35
39
|
vp = get_version_parts(version[VERSION_NAME])
|
36
40
|
return "#{vp[MAJOR_NUMBER]}.#{vp[MINOR_NUMBER]}" unless is_hotfix?(version)
|
37
41
|
|
@@ -42,33 +46,28 @@ module Fastlane
|
|
42
46
|
#
|
43
47
|
# @return [Hash] A hash with 2 keys "name" and "code" containing the extracted version name and code, respectively
|
44
48
|
#
|
45
|
-
def self.get_release_version
|
46
|
-
return get_version_from_properties if File.exist?(
|
49
|
+
def self.get_release_version(build_gradle_path:, version_properties_path:, has_alpha_version:)
|
50
|
+
return get_version_from_properties(version_properties_path: version_properties_path) if File.exist?(version_properties_path)
|
47
51
|
|
48
|
-
section =
|
49
|
-
|
50
|
-
|
51
|
-
code = get_version_build_from_gradle_file(gradle_path, section)
|
52
|
+
section = has_alpha_version.nil? ? 'defaultConfig' : 'vanilla {'
|
53
|
+
name = get_version_name_from_gradle_file(build_gradle_path, section)
|
54
|
+
code = get_version_build_from_gradle_file(build_gradle_path, section)
|
52
55
|
return { VERSION_NAME => name, VERSION_CODE => code }
|
53
56
|
end
|
54
57
|
|
55
|
-
def self.version_properties_file
|
56
|
-
File.join(ENV['PROJECT_ROOT_FOLDER'] || '.', 'version.properties')
|
57
|
-
end
|
58
|
-
|
59
58
|
# Extract the version name and code from the `version.properties` file in the project root
|
60
59
|
#
|
61
60
|
# @param [Boolean] is_alpha true if the alpha version should be returned, false otherwise
|
62
61
|
#
|
63
62
|
# @return [Hash] A hash with 2 keys "name" and "code" containing the extracted version name and code, respectively
|
64
63
|
#
|
65
|
-
def self.get_version_from_properties(is_alpha: false)
|
66
|
-
return nil unless File.exist?(
|
64
|
+
def self.get_version_from_properties(version_properties_path:, is_alpha: false)
|
65
|
+
return nil unless File.exist?(version_properties_path)
|
67
66
|
|
68
67
|
version_name_key = is_alpha ? 'alpha.versionName' : 'versionName'
|
69
68
|
version_code_key = is_alpha ? 'alpha.versionCode' : 'versionCode'
|
70
69
|
|
71
|
-
text = File.read(
|
70
|
+
text = File.read(version_properties_path)
|
72
71
|
name = text.match(/#{version_name_key}=(\S*)/m)&.captures&.first
|
73
72
|
code = text.match(/#{version_code_key}=(\S*)/m)&.captures&.first
|
74
73
|
|
@@ -80,15 +79,14 @@ module Fastlane
|
|
80
79
|
# @return [Hash] A hash with 2 keys `"name"` and `"code"` containing the extracted version name and code, respectively,
|
81
80
|
# or `nil` if `$HAS_ALPHA_VERSION` is not defined.
|
82
81
|
#
|
83
|
-
def self.get_alpha_version
|
84
|
-
return get_version_from_properties(is_alpha: true) if File.exist?(
|
82
|
+
def self.get_alpha_version(build_gradle_path:, version_properties_path:, has_alpha_version:)
|
83
|
+
return get_version_from_properties(version_properties_path: version_properties_path, is_alpha: true) if File.exist?(version_properties_path)
|
85
84
|
|
86
|
-
return nil if
|
85
|
+
return nil if has_alpha_version.nil?
|
87
86
|
|
88
87
|
section = 'defaultConfig'
|
89
|
-
|
90
|
-
|
91
|
-
code = get_version_build_from_gradle_file(gradle_path, section)
|
88
|
+
name = get_version_name_from_gradle_file(build_gradle_path, section)
|
89
|
+
code = get_version_build_from_gradle_file(build_gradle_path, section)
|
92
90
|
return { VERSION_NAME => name, VERSION_CODE => code }
|
93
91
|
end
|
94
92
|
|
@@ -280,9 +278,13 @@ module Fastlane
|
|
280
278
|
#
|
281
279
|
# @return [String] The next release version name to use after bumping the currently used release version.
|
282
280
|
#
|
283
|
-
def self.bump_version_release
|
281
|
+
def self.bump_version_release(build_gradle_path:, version_properties_path:, has_alpha_version:)
|
284
282
|
# Bump release
|
285
|
-
current_version = self.get_release_version
|
283
|
+
current_version = self.get_release_version(
|
284
|
+
build_gradle_path: build_gradle_path,
|
285
|
+
version_properties_path: version_properties_path,
|
286
|
+
has_alpha_version: has_alpha_version
|
287
|
+
)
|
286
288
|
UI.message("Current version: #{current_version[VERSION_NAME]}")
|
287
289
|
new_version = calc_next_release_base_version(current_version)
|
288
290
|
UI.message("New version: #{new_version[VERSION_NAME]}")
|
@@ -296,23 +298,23 @@ module Fastlane
|
|
296
298
|
# @param [Hash] new_version_beta The version hash for the beta, containing values for keys "name" and "code"
|
297
299
|
# @param [Hash] new_version_alpha The version hash for the alpha , containing values for keys "name" and "code"
|
298
300
|
#
|
299
|
-
def self.update_versions(new_version_beta, new_version_alpha)
|
300
|
-
if File.exist?(
|
301
|
+
def self.update_versions(new_version_beta, new_version_alpha, version_properties_path:, has_alpha_version:)
|
302
|
+
if File.exist?(version_properties_path)
|
301
303
|
replacements = {
|
302
304
|
versionName: (new_version_beta || {})[VERSION_NAME],
|
303
305
|
versionCode: (new_version_beta || {})[VERSION_CODE],
|
304
306
|
'alpha.versionName': (new_version_alpha || {})[VERSION_NAME],
|
305
307
|
'alpha.versionCode': (new_version_alpha || {})[VERSION_CODE]
|
306
308
|
}
|
307
|
-
content = File.read(
|
309
|
+
content = File.read(version_properties_path)
|
308
310
|
content.gsub!(/^(.*) ?=.*$/) do |line|
|
309
311
|
key = Regexp.last_match(1).to_sym
|
310
312
|
value = replacements[key]
|
311
313
|
value.nil? ? line : "#{key}=#{value}"
|
312
314
|
end
|
313
|
-
File.write(
|
315
|
+
File.write(version_properties_path, content)
|
314
316
|
else
|
315
|
-
self.update_version(new_version_beta,
|
317
|
+
self.update_version(new_version_beta, has_alpha_version.nil? ? 'defaultConfig' : 'vanilla {')
|
316
318
|
self.update_version(new_version_alpha, 'defaultConfig') unless new_version_alpha.nil?
|
317
319
|
end
|
318
320
|
end
|
@@ -337,12 +339,10 @@ module Fastlane
|
|
337
339
|
# @param [String] import_key The key to look for
|
338
340
|
# @return [String] The value of the key, or nil if not found
|
339
341
|
#
|
340
|
-
def self.get_library_version_from_gradle_config(import_key:)
|
341
|
-
|
342
|
+
def self.get_library_version_from_gradle_config(build_gradle_path:, import_key:)
|
343
|
+
return nil unless File.exist?(build_gradle_path)
|
342
344
|
|
343
|
-
|
344
|
-
|
345
|
-
File.open(gradle_file_path, 'r') do |f|
|
345
|
+
File.open(build_gradle_path, 'r') do |f|
|
346
346
|
text = f.read
|
347
347
|
text.match(/^\s*(?:\w*\.)?#{Regexp.escape(import_key)}\s*=\s*['"](.*?)["']/m)&.captures&.first
|
348
348
|
end
|
@@ -456,19 +456,6 @@ module Fastlane
|
|
456
456
|
return nil
|
457
457
|
end
|
458
458
|
|
459
|
-
# The path to the build.gradle file for the project.
|
460
|
-
#
|
461
|
-
# @env PROJECT_ROOT_FOLDER The path to the root of the project (the folder containing the `.git` directory).
|
462
|
-
# @env PROJECT_NAME The name of the project, i.e. the name of the subdirectory containing the project's `build.gradle` file.
|
463
|
-
#
|
464
|
-
# @return [String] The path of the `build.gradle` file inside the project subfolder in the project's repo
|
465
|
-
#
|
466
|
-
def self.gradle_path
|
467
|
-
UI.user_error!("You need to set the `PROJECT_ROOT_FOLDER` environment variable to the path to the project's root") if ENV['PROJECT_ROOT_FOLDER'].nil?
|
468
|
-
UI.user_error!('You need to set the `PROJECT_NAME` environment variable to the relative path to the project subfolder name') if ENV['PROJECT_NAME'].nil?
|
469
|
-
File.join(ENV['PROJECT_ROOT_FOLDER'], ENV['PROJECT_NAME'], 'build.gradle')
|
470
|
-
end
|
471
|
-
|
472
459
|
# Update both the versionName and versionCode of the build.gradle file to the specified version.
|
473
460
|
#
|
474
461
|
# @param [Hash] version The version hash, containing values for keys "name" and "code"
|
@@ -477,12 +464,11 @@ module Fastlane
|
|
477
464
|
# @todo This implementation is very fragile. This should be done parsing the file in a proper way.
|
478
465
|
# Leveraging gradle itself is probably the easiest way.
|
479
466
|
#
|
480
|
-
def self.update_version(version, section)
|
481
|
-
gradle_path = self.gradle_path
|
467
|
+
def self.update_version(version, section, build_gradle_path:)
|
482
468
|
temp_file = Tempfile.new('fastlaneIncrementVersion')
|
483
469
|
found_section = false
|
484
470
|
version_updated = 0
|
485
|
-
File.open(
|
471
|
+
File.open(build_gradle_path, 'r') do |file|
|
486
472
|
file.each_line do |line|
|
487
473
|
if found_section
|
488
474
|
if version_updated < 2
|
@@ -508,7 +494,7 @@ module Fastlane
|
|
508
494
|
end
|
509
495
|
temp_file.rewind
|
510
496
|
temp_file.close
|
511
|
-
FileUtils.mv(temp_file.path,
|
497
|
+
FileUtils.mv(temp_file.path, build_gradle_path)
|
512
498
|
temp_file.unlink
|
513
499
|
end
|
514
500
|
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Helper
|
3
|
+
# A helper class to store deprecated methods and actions
|
4
|
+
class Deprecated
|
5
|
+
# Creates a has_alpha_version Fastlane ConfigItem
|
6
|
+
#
|
7
|
+
# @return [FastlaneCore::ConfigItem] The Fastlane ConfigItem for the `HAS_ALPHA_VERSION` environment variable
|
8
|
+
#
|
9
|
+
def self.has_alpha_version_config_item
|
10
|
+
verify_block = proc do
|
11
|
+
UI.deprecated('DEPRECATED: The HAS_ALPHA_VERSION environment variable and config item are deprecated and will be removed in a future version of the Release Toolkit.')
|
12
|
+
end
|
13
|
+
|
14
|
+
FastlaneCore::ConfigItem.new(
|
15
|
+
key: :has_alpha_version,
|
16
|
+
env_name: 'HAS_ALPHA_VERSION',
|
17
|
+
description: 'A boolean for whether there is an alpha version of the app or not',
|
18
|
+
deprecated: true,
|
19
|
+
optional: true,
|
20
|
+
verify_block: verify_block,
|
21
|
+
type: Boolean
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Creates a project_root_folder Fastlane ConfigItem
|
26
|
+
#
|
27
|
+
# @return [FastlaneCore::ConfigItem] The Fastlane ConfigItem for the `PROJECT_ROOT_FOLDER` environment variable
|
28
|
+
#
|
29
|
+
def self.project_root_folder_config_item
|
30
|
+
verify_block = proc do
|
31
|
+
UI.deprecated('DEPRECATED: The PROJECT_ROOT_FOLDER environment variable and config item are deprecated and will be removed in a future version of the Release Toolkit. Please provide a full path instead.')
|
32
|
+
end
|
33
|
+
|
34
|
+
FastlaneCore::ConfigItem.new(
|
35
|
+
key: :project_root_folder,
|
36
|
+
env_name: 'PROJECT_ROOT_FOLDER',
|
37
|
+
description: 'The path to the project root folder',
|
38
|
+
deprecated: true,
|
39
|
+
optional: true,
|
40
|
+
verify_block: verify_block,
|
41
|
+
type: String
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Creates a project_root_folder Fastlane ConfigItem
|
46
|
+
#
|
47
|
+
# @return [FastlaneCore::ConfigItem] The Fastlane ConfigItem for the `PROJECT_ROOT_FOLDER` environment variable
|
48
|
+
#
|
49
|
+
def self.project_name_config_item
|
50
|
+
verify_block = proc do
|
51
|
+
UI.deprecated('DEPRECATED: The PROJECT_NAME environment variable and config item are deprecated and will be removed in a future version of the Release Toolkit. Please provide a full path instead.')
|
52
|
+
end
|
53
|
+
|
54
|
+
FastlaneCore::ConfigItem.new(
|
55
|
+
key: :project_name,
|
56
|
+
env_name: 'PROJECT_NAME',
|
57
|
+
description: 'The app project name',
|
58
|
+
deprecated: true,
|
59
|
+
optional: true,
|
60
|
+
verify_block: verify_block,
|
61
|
+
type: String
|
62
|
+
)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
data/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/abstract_version_calculator.rb
CHANGED
@@ -79,6 +79,16 @@ module Fastlane
|
|
79
79
|
|
80
80
|
new_version
|
81
81
|
end
|
82
|
+
|
83
|
+
# Calculate whether a release is a hotfix release.
|
84
|
+
#
|
85
|
+
# @param [AppVersion] version The version to check.
|
86
|
+
#
|
87
|
+
# @return [Boolean] Whether the release is a hotfix release.
|
88
|
+
#
|
89
|
+
def release_is_hotfix?(version:)
|
90
|
+
version.patch.positive?
|
91
|
+
end
|
82
92
|
end
|
83
93
|
end
|
84
94
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-wpmreleasetoolkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.
|
4
|
+
version: 9.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Automattic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -115,6 +115,9 @@ dependencies:
|
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '1.11'
|
118
|
+
- - "<"
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '1.16'
|
118
121
|
type: :runtime
|
119
122
|
prerelease: false
|
120
123
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -122,6 +125,9 @@ dependencies:
|
|
122
125
|
- - "~>"
|
123
126
|
- !ruby/object:Gem::Version
|
124
127
|
version: '1.11'
|
128
|
+
- - "<"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '1.16'
|
125
131
|
- !ruby/object:Gem::Dependency
|
126
132
|
name: octokit
|
127
133
|
requirement: !ruby/object:Gem::Requirement
|
@@ -499,6 +505,7 @@ files:
|
|
499
505
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/app_size_metrics_helper.rb
|
500
506
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/ci_helper.rb
|
501
507
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb
|
508
|
+
- lib/fastlane/plugin/wpmreleasetoolkit/helper/deprecated.rb
|
502
509
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/encryption_helper.rb
|
503
510
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/filesystem_helper.rb
|
504
511
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb
|