fastlane-plugin-wpmreleasetoolkit 1.2.0 → 2.0.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 +2 -2
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_prechecks.rb +3 -2
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_beta.rb +17 -24
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_final_release.rb +18 -22
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_hotfix.rb +17 -28
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_release.rb +22 -38
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_codefreeze_prechecks.rb +4 -3
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_current_branch_is_hotfix.rb +3 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_alpha_version.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_release_version.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_hotifx_prechecks.rb +4 -4
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_tag_build.rb +3 -3
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_translation_progress.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_hotfix.rb +30 -15
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/an_metadata_update_helper.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_git_helper.rb +14 -5
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb +84 -41
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/filesystem_helper.rb +3 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/glotpress_helper.rb +28 -5
- data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +1 -1
- metadata +24 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebad531acd982b1354116d3f924974a8376da07fc7014646c19d40097fb0ca6e
|
4
|
+
data.tar.gz: 6594d0af0ddd193cb12007d7cc145c11c519129e3df226091b1fae6f608f8c3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81278eaaa129a68388f06f55b125254a5464ba146af61c8f8f4a6dc6905bd4ede2774950ee7b4d045e3e88d202e38b57e093bda8ce3ccae0a712ca346a79e68d
|
7
|
+
data.tar.gz: fab14969f2a2063c6b0a5ee451dd72220416355b93c66b55e9c80656f247de8bbba8e67f4b455f46d6636950139a57e0a86d6cbbbee6065d52113757d3d8e233
|
@@ -23,7 +23,7 @@ module Fastlane
|
|
23
23
|
|
24
24
|
# Check user overwrite
|
25
25
|
unless params[:base_version].nil?
|
26
|
-
overwrite_version = get_user_build_version(params[:base_version], message)
|
26
|
+
overwrite_version = get_user_build_version(version: params[:base_version], message: message)
|
27
27
|
release_version = overwrite_version[0]
|
28
28
|
alpha_release_version = overwrite_version[1]
|
29
29
|
end
|
@@ -47,7 +47,7 @@ module Fastlane
|
|
47
47
|
[next_beta_version, next_alpha_version]
|
48
48
|
end
|
49
49
|
|
50
|
-
def self.get_user_build_version(version
|
50
|
+
def self.get_user_build_version(version:, message:)
|
51
51
|
UI.user_error!("Release branch for version #{version} doesn't exist. Abort.") unless Fastlane::Helper::GitHelper.checkout_and_pull(release: version)
|
52
52
|
release_version = Fastlane::Helper::Android::VersionHelper.get_release_version
|
53
53
|
message << "Looking at branch release/#{version} as requested by user. Detected version: #{release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}.\n"
|
@@ -3,14 +3,15 @@ module Fastlane
|
|
3
3
|
class AndroidBuildPrechecksAction < Action
|
4
4
|
def self.run(params)
|
5
5
|
require_relative '../../helper/android/android_version_helper'
|
6
|
+
require_relative '../../helper/git_helper'
|
6
7
|
|
7
8
|
UI.user_error!("Can't build beta and final at the same time!") if params[:final] && params[:beta]
|
8
9
|
|
9
10
|
Fastlane::Helper::GitHelper.ensure_on_branch!('release') unless other_action.is_ci()
|
10
11
|
|
11
12
|
message = ''
|
12
|
-
beta_version = Fastlane::Helper::Android::VersionHelper.get_release_version
|
13
|
-
alpha_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version
|
13
|
+
beta_version = Fastlane::Helper::Android::VersionHelper.get_release_version unless !params[:beta] && !params[:final]
|
14
|
+
alpha_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version if params[:alpha]
|
14
15
|
|
15
16
|
UI.user_error!("Can't build a final release out of this branch because it's configured as a beta release!") if params[:final] && Fastlane::Helper::Android::VersionHelper.is_beta_version?(beta_version)
|
16
17
|
|
@@ -8,11 +8,21 @@ module Fastlane
|
|
8
8
|
require_relative '../../helper/android/android_version_helper'
|
9
9
|
|
10
10
|
Fastlane::Helper::GitHelper.ensure_on_branch!('release')
|
11
|
-
create_config()
|
12
|
-
show_config()
|
13
11
|
|
14
|
-
|
15
|
-
Fastlane::Helper::Android::VersionHelper.
|
12
|
+
current_version = Fastlane::Helper::Android::VersionHelper.get_release_version
|
13
|
+
current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version
|
14
|
+
new_version_beta = Fastlane::Helper::Android::VersionHelper.calc_next_beta_version(current_version, current_version_alpha)
|
15
|
+
new_version_alpha = current_version_alpha.nil? ? nil : Fastlane::Helper::Android::VersionHelper.calc_next_alpha_version(new_version_beta, current_version_alpha)
|
16
|
+
|
17
|
+
vname = Fastlane::Helper::Android::VersionHelper::VERSION_NAME
|
18
|
+
vcode = Fastlane::Helper::Android::VersionHelper::VERSION_CODE
|
19
|
+
UI.message("Current version: #{current_version[vname]}(#{current_version[vcode]})")
|
20
|
+
UI.message("Current alpha version: #{current_version_alpha[vname]}(#{current_version_alpha[vcode]})") unless current_version_alpha.nil?
|
21
|
+
UI.message("New beta version: #{new_version_beta[vname]}(#{new_version_beta[vcode]})")
|
22
|
+
UI.message("New alpha version: #{new_version_alpha[vname]}(#{new_version_alpha[vcode]})") unless current_version_alpha.nil?
|
23
|
+
|
24
|
+
UI.message 'Updating app version...'
|
25
|
+
Fastlane::Helper::Android::VersionHelper.update_versions(new_version_beta, new_version_alpha)
|
16
26
|
UI.message 'Done!'
|
17
27
|
|
18
28
|
Fastlane::Helper::Android::GitHelper.commit_version_bump()
|
@@ -23,14 +33,15 @@ module Fastlane
|
|
23
33
|
#####################################################
|
24
34
|
|
25
35
|
def self.description
|
26
|
-
'Bumps the version of the app for a new beta'
|
36
|
+
'Bumps the version of the app for a new beta.'
|
27
37
|
end
|
28
38
|
|
29
39
|
def self.details
|
30
|
-
'Bumps the version of the app for a new beta'
|
40
|
+
'Bumps the version of the app for a new beta.'
|
31
41
|
end
|
32
42
|
|
33
43
|
def self.available_options
|
44
|
+
# Define all options your action supports.
|
34
45
|
end
|
35
46
|
|
36
47
|
def self.output
|
@@ -46,24 +57,6 @@ module Fastlane
|
|
46
57
|
def self.is_supported?(platform)
|
47
58
|
platform == :android
|
48
59
|
end
|
49
|
-
|
50
|
-
private
|
51
|
-
|
52
|
-
def self.create_config
|
53
|
-
@current_version = Fastlane::Helper::Android::VersionHelper.get_release_version()
|
54
|
-
@current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version()
|
55
|
-
@new_version_beta = Fastlane::Helper::Android::VersionHelper.calc_next_beta_version(@current_version, @current_version_alpha)
|
56
|
-
@new_version_alpha = ENV['HAS_ALPHA_VERSION'].nil? ? nil : Fastlane::Helper::Android::VersionHelper.calc_next_alpha_version(@new_version_beta, @current_version_alpha)
|
57
|
-
end
|
58
|
-
|
59
|
-
def self.show_config
|
60
|
-
vname = Fastlane::Helper::Android::VersionHelper::VERSION_NAME
|
61
|
-
vcode = Fastlane::Helper::Android::VersionHelper::VERSION_CODE
|
62
|
-
UI.message("Current version: #{@current_version[vname]}(#{@current_version[vcode]})")
|
63
|
-
UI.message("Current alpha version: #{@current_version_alpha[vname]}(#{@current_version_alpha[vcode]})") unless ENV['HAS_ALPHA_VERSION'].nil?
|
64
|
-
UI.message("New beta version: #{@new_version_beta[vname]}(#{@new_version_beta[vcode]})")
|
65
|
-
UI.message("New alpha version: #{@new_version_alpha[vname]}(#{@new_version_alpha[vcode]})") unless ENV['HAS_ALPHA_VERSION'].nil?
|
66
|
-
end
|
67
60
|
end
|
68
61
|
end
|
69
62
|
end
|
data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_final_release.rb
CHANGED
@@ -8,11 +8,19 @@ module Fastlane
|
|
8
8
|
require_relative '../../helper/android/android_version_helper'
|
9
9
|
|
10
10
|
Fastlane::Helper::GitHelper.ensure_on_branch!('release')
|
11
|
-
create_config()
|
12
|
-
show_config()
|
13
11
|
|
14
|
-
|
15
|
-
Fastlane::Helper::Android::VersionHelper.
|
12
|
+
current_version = Fastlane::Helper::Android::VersionHelper.get_release_version
|
13
|
+
current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version
|
14
|
+
final_version = Fastlane::Helper::Android::VersionHelper.calc_final_release_version(current_version, current_version_alpha)
|
15
|
+
|
16
|
+
vname = Fastlane::Helper::Android::VersionHelper::VERSION_NAME
|
17
|
+
vcode = Fastlane::Helper::Android::VersionHelper::VERSION_CODE
|
18
|
+
UI.message("Current version: #{current_version[vname]}(#{current_version[vcode]})")
|
19
|
+
UI.message("Current alpha version: #{current_version_alpha[vname]}(#{current_version_alpha[vcode]})") unless current_version_alpha.nil?
|
20
|
+
UI.message("New release version: #{final_version[vname]}(#{final_version[vcode]})")
|
21
|
+
|
22
|
+
UI.message 'Updating app version...'
|
23
|
+
Fastlane::Helper::Android::VersionHelper.update_versions(final_version, current_version_alpha)
|
16
24
|
UI.message 'Done!'
|
17
25
|
|
18
26
|
Fastlane::Helper::Android::GitHelper.commit_version_bump()
|
@@ -23,11 +31,15 @@ module Fastlane
|
|
23
31
|
#####################################################
|
24
32
|
|
25
33
|
def self.description
|
26
|
-
'Bumps the version of the app for a new beta'
|
34
|
+
'Bumps the version of the app for a new beta.'
|
27
35
|
end
|
28
36
|
|
29
37
|
def self.details
|
30
|
-
'Bumps the version of the app for a new beta'
|
38
|
+
'Bumps the version of the app for a new beta.'
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.available_options
|
42
|
+
# Define all options your action supports.
|
31
43
|
end
|
32
44
|
|
33
45
|
def self.authors
|
@@ -37,22 +49,6 @@ module Fastlane
|
|
37
49
|
def self.is_supported?(platform)
|
38
50
|
platform == :android
|
39
51
|
end
|
40
|
-
|
41
|
-
private
|
42
|
-
|
43
|
-
def self.create_config
|
44
|
-
@current_version = Fastlane::Helper::Android::VersionHelper.get_release_version()
|
45
|
-
@current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version()
|
46
|
-
@final_version = Fastlane::Helper::Android::VersionHelper.calc_final_release_version(@current_version, @current_version_alpha)
|
47
|
-
end
|
48
|
-
|
49
|
-
def self.show_config
|
50
|
-
vname = Fastlane::Helper::Android::VersionHelper::VERSION_NAME
|
51
|
-
vcode = Fastlane::Helper::Android::VersionHelper::VERSION_CODE
|
52
|
-
UI.message("Current version: #{@current_version[vname]}(#{@current_version[vcode]})")
|
53
|
-
UI.message("Current alpha version: #{@current_version_alpha[vname]}(#{@current_version_alpha[vcode]})") unless ENV['HAS_ALPHA_VERSION'].nil?
|
54
|
-
UI.message("New release version: #{@final_version[vname]}(#{@final_version[vcode]})")
|
55
|
-
end
|
56
52
|
end
|
57
53
|
end
|
58
54
|
end
|
@@ -6,11 +6,19 @@ module Fastlane
|
|
6
6
|
|
7
7
|
require_relative '../../helper/android/android_git_helper'
|
8
8
|
Fastlane::Helper::GitHelper.create_branch("release/#{params[:version_name]}", from: params[:previous_version_name])
|
9
|
-
create_config(params[:previous_version_name], params[:version_name], params[:version_code])
|
10
|
-
show_config()
|
11
9
|
|
12
|
-
|
13
|
-
Fastlane::Helper::Android::VersionHelper.
|
10
|
+
current_version = Fastlane::Helper::Android::VersionHelper.get_release_version
|
11
|
+
new_version = Fastlane::Helper::Android::VersionHelper.calc_next_hotfix_version(params[:version_name], params[:version_code]) # NOTE: this just puts the name/code values in a tuple, unchanged (no actual calc/bumping)
|
12
|
+
new_release_branch = "release/#{params[:version_name]}"
|
13
|
+
|
14
|
+
name_key = Fastlane::Helper::Android::VersionHelper::VERSION_NAME
|
15
|
+
code_key = Fastlane::Helper::Android::VersionHelper::VERSION_CODE
|
16
|
+
UI.message("Current version: #{current_version[name_key]} (#{current_version[code_key]})")
|
17
|
+
UI.message("New hotfix version: #{new_version[name_key]} (#{new_version[code_key]})")
|
18
|
+
UI.message("Release branch: #{new_release_branch}")
|
19
|
+
|
20
|
+
UI.message 'Updating app version...'
|
21
|
+
Fastlane::Helper::Android::VersionHelper.update_versions(new_version, nil)
|
14
22
|
UI.message 'Done!'
|
15
23
|
|
16
24
|
Fastlane::Helper::Android::GitHelper.commit_version_bump()
|
@@ -23,29 +31,26 @@ module Fastlane
|
|
23
31
|
#####################################################
|
24
32
|
|
25
33
|
def self.description
|
26
|
-
'Bumps the version of the app
|
34
|
+
'Bumps the version of the app for a new beta.'
|
27
35
|
end
|
28
36
|
|
29
37
|
def self.details
|
30
|
-
'Bumps the version of the app
|
38
|
+
'Bumps the version of the app for a new beta.'
|
31
39
|
end
|
32
40
|
|
33
41
|
def self.available_options
|
34
|
-
# Define all options your action supports.
|
35
|
-
|
36
|
-
# Below a few examples
|
37
42
|
[
|
38
43
|
FastlaneCore::ConfigItem.new(key: :version_name,
|
39
44
|
env_name: 'FL_ANDROID_BUMP_VERSION_HOTFIX_VERSION',
|
40
|
-
description: 'The version
|
45
|
+
description: 'The version name for the hotfix',
|
41
46
|
is_string: true),
|
42
47
|
FastlaneCore::ConfigItem.new(key: :version_code,
|
43
48
|
env_name: 'FL_ANDROID_BUMP_VERSION_HOTFIX_CODE',
|
44
|
-
description: 'The version
|
49
|
+
description: 'The version code for the hotfix'),
|
45
50
|
FastlaneCore::ConfigItem.new(key: :previous_version_name,
|
46
51
|
env_name: 'FL_ANDROID_BUMP_VERSION_HOTFIX_PREVIOUS_VERSION',
|
47
52
|
description: 'The version to branch from',
|
48
|
-
is_string: true),
|
53
|
+
is_string: true),
|
49
54
|
]
|
50
55
|
end
|
51
56
|
|
@@ -56,22 +61,6 @@ module Fastlane
|
|
56
61
|
def self.is_supported?(platform)
|
57
62
|
platform == :android
|
58
63
|
end
|
59
|
-
|
60
|
-
private
|
61
|
-
|
62
|
-
def self.create_config(previous_version, new_version_name, new_version_code)
|
63
|
-
@current_version = Fastlane::Helper::Android::VersionHelper.get_release_version()
|
64
|
-
@current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version()
|
65
|
-
@new_version = Fastlane::Helper::Android::VersionHelper.calc_next_hotfix_version(new_version_name, new_version_code)
|
66
|
-
@new_short_version = new_version_name
|
67
|
-
@new_release_branch = "release/#{@new_short_version}"
|
68
|
-
end
|
69
|
-
|
70
|
-
def self.show_config
|
71
|
-
UI.message("Current version: #{@current_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{@current_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]})")
|
72
|
-
UI.message("New hotfix version: #{@new_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{@new_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]})")
|
73
|
-
UI.message("Release branch: #{@new_release_branch}")
|
74
|
-
end
|
75
64
|
end
|
76
65
|
end
|
77
66
|
end
|
@@ -11,17 +11,30 @@ module Fastlane
|
|
11
11
|
other_action.ensure_git_branch(branch: 'develop')
|
12
12
|
|
13
13
|
# Create new configuration
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
new_short_version = Fastlane::Helper::Android::VersionHelper.bump_version_release
|
15
|
+
|
16
|
+
current_version = Fastlane::Helper::Android::VersionHelper.get_release_version
|
17
|
+
current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version
|
18
|
+
new_version_beta = Fastlane::Helper::Android::VersionHelper.calc_next_release_version(current_version, current_version_alpha)
|
19
|
+
new_version_alpha = current_version_alpha.nil? ? nil : Fastlane::Helper::Android::VersionHelper.calc_next_alpha_version(new_version_beta, current_version_alpha)
|
20
|
+
new_release_branch = "release/#{new_short_version}"
|
21
|
+
|
22
|
+
vname = Fastlane::Helper::Android::VersionHelper::VERSION_NAME
|
23
|
+
vcode = Fastlane::Helper::Android::VersionHelper::VERSION_CODE
|
24
|
+
UI.message("Current version: #{current_version[vname]}(#{current_version[vcode]})")
|
25
|
+
UI.message("Current alpha version: #{current_version_alpha[vname]}(#{current_version_alpha[vcode]})") unless current_version_alpha.nil?
|
26
|
+
UI.message("New beta version: #{new_version_beta[vname]}(#{new_version_beta[vcode]})")
|
27
|
+
UI.message("New alpha version: #{new_version_alpha[vname]}(#{new_version_alpha[vcode]})") unless current_version_alpha.nil?
|
28
|
+
UI.message("New version: #{new_short_version}")
|
29
|
+
UI.message("Release branch: #{new_release_branch}")
|
17
30
|
|
18
31
|
# Update local develop and branch
|
19
32
|
UI.message 'Creating new branch...'
|
20
|
-
Fastlane::Helper::GitHelper.create_branch(
|
33
|
+
Fastlane::Helper::GitHelper.create_branch(new_release_branch, from: 'develop')
|
21
34
|
UI.message 'Done!'
|
22
35
|
|
23
|
-
UI.message 'Updating
|
24
|
-
Fastlane::Helper::Android::VersionHelper.update_versions(
|
36
|
+
UI.message 'Updating app version...'
|
37
|
+
Fastlane::Helper::Android::VersionHelper.update_versions(new_version_beta, new_version_alpha)
|
25
38
|
Fastlane::Helper::Android::GitHelper.commit_version_bump()
|
26
39
|
UI.message 'Done.'
|
27
40
|
end
|
@@ -31,14 +44,15 @@ module Fastlane
|
|
31
44
|
#####################################################
|
32
45
|
|
33
46
|
def self.description
|
34
|
-
'Bumps the version of the app
|
47
|
+
'Bumps the version of the app for a new beta.'
|
35
48
|
end
|
36
49
|
|
37
50
|
def self.details
|
38
|
-
'Bumps the version of the app
|
51
|
+
'Bumps the version of the app for a new beta.'
|
39
52
|
end
|
40
53
|
|
41
54
|
def self.available_options
|
55
|
+
# Define all options your action supports.
|
42
56
|
end
|
43
57
|
|
44
58
|
def self.output
|
@@ -54,36 +68,6 @@ module Fastlane
|
|
54
68
|
def self.is_supported?(platform)
|
55
69
|
platform == :android
|
56
70
|
end
|
57
|
-
|
58
|
-
private
|
59
|
-
|
60
|
-
def self.create_config
|
61
|
-
@current_version = Fastlane::Helper::Android::VersionHelper.get_release_version()
|
62
|
-
@current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version()
|
63
|
-
@new_version_beta = Fastlane::Helper::Android::VersionHelper.calc_next_release_version(@current_version, @current_version_alpha)
|
64
|
-
@new_version_alpha = ENV['HAS_ALPHA_VERSION'].nil? ? nil : Fastlane::Helper::Android::VersionHelper.calc_next_alpha_version(@new_version_beta, @current_version_alpha)
|
65
|
-
@new_release_branch = "release/#{@new_short_version}"
|
66
|
-
end
|
67
|
-
|
68
|
-
def self.show_config
|
69
|
-
vname = Fastlane::Helper::Android::VersionHelper::VERSION_NAME
|
70
|
-
vcode = Fastlane::Helper::Android::VersionHelper::VERSION_CODE
|
71
|
-
UI.message("Current version: #{@current_version[vname]}(#{@current_version[vcode]})")
|
72
|
-
UI.message("Current alpha version: #{@current_version_alpha[vname]}(#{@current_version_alpha[vcode]})") unless ENV['HAS_ALPHA_VERSION'].nil?
|
73
|
-
UI.message("New beta version: #{@new_version_beta[vname]}(#{@new_version_beta[vcode]})")
|
74
|
-
UI.message("New alpha version: #{@new_version_alpha[vname]}(#{@new_version_alpha[vcode]})") unless ENV['HAS_ALPHA_VERSION'].nil?
|
75
|
-
UI.message("New version: #{@new_short_version}")
|
76
|
-
UI.message("Release branch: #{@new_release_branch}")
|
77
|
-
end
|
78
|
-
|
79
|
-
def self.update_glotpress_key
|
80
|
-
dm_file = ENV['DOWNLOAD_METADATA']
|
81
|
-
if File.exist?(dm_file)
|
82
|
-
sh("sed -i '' \"s/let glotPressWhatsNewKey.*/let glotPressWhatsNewKey = \\\"v#{@new_short_version}-whats-new\\\"/\" #{dm_file}")
|
83
|
-
else
|
84
|
-
UI.user_error!("Can't find #{dm_file}.")
|
85
|
-
end
|
86
|
-
end
|
87
71
|
end
|
88
72
|
end
|
89
73
|
end
|
@@ -18,14 +18,15 @@ module Fastlane
|
|
18
18
|
current_version = Fastlane::Helper::Android::VersionHelper.get_release_version
|
19
19
|
current_alpha_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version
|
20
20
|
next_version = Fastlane::Helper::Android::VersionHelper.calc_next_release_version(current_version, current_alpha_version)
|
21
|
-
next_alpha_version =
|
21
|
+
next_alpha_version = current_alpha_version.nil? ? nil : Fastlane::Helper::Android::VersionHelper.calc_next_alpha_version(next_version, current_alpha_version)
|
22
22
|
|
23
|
+
no_alpha_version_message = "No alpha version configured. If you wish to configure an alpha version please update version.properties to include an alpha key for this app\n"
|
23
24
|
# Ask user confirmation
|
24
25
|
unless params[:skip_confirm]
|
25
26
|
confirm_message = "Building a new release branch starting from develop.\nCurrent version is #{current_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]} (#{current_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}).\n"
|
26
|
-
confirm_message +=
|
27
|
+
confirm_message += current_alpha_version.nil? ? no_alpha_version_message : "Current Alpha version is #{current_alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]} (#{current_alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}).\n"
|
27
28
|
confirm_message += "After codefreeze the new version will be: #{next_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]} (#{next_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}).\n"
|
28
|
-
confirm_message +=
|
29
|
+
confirm_message += current_alpha_version.nil? ? '' : "After codefreeze the new Alpha will be: #{next_alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]} (#{next_alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}).\n"
|
29
30
|
confirm_message += 'Do you want to continue?'
|
30
31
|
UI.user_error!('Aborted by user request') unless UI.confirm(confirm_message)
|
31
32
|
end
|
data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_current_branch_is_hotfix.rb
CHANGED
@@ -7,7 +7,8 @@ module Fastlane
|
|
7
7
|
class AndroidCurrentBranchIsHotfixAction < Action
|
8
8
|
def self.run(params)
|
9
9
|
require_relative '../../helper/android/android_version_helper'
|
10
|
-
Fastlane::Helper::Android::VersionHelper.
|
10
|
+
version = Fastlane::Helper::Android::VersionHelper.get_release_version
|
11
|
+
Fastlane::Helper::Android::VersionHelper.is_hotfix?(version)
|
11
12
|
end
|
12
13
|
|
13
14
|
#####################################################
|
@@ -23,6 +24,7 @@ module Fastlane
|
|
23
24
|
end
|
24
25
|
|
25
26
|
def self.available_options
|
27
|
+
# Define all options your action supports.
|
26
28
|
end
|
27
29
|
|
28
30
|
def self.output
|
data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb
CHANGED
@@ -27,7 +27,7 @@ module Fastlane
|
|
27
27
|
|
28
28
|
def self.details
|
29
29
|
'This action extracts the version of the library which is imported by the client app' \
|
30
|
-
|
30
|
+
'and downloads the request file from the relevant GitHub release'
|
31
31
|
end
|
32
32
|
|
33
33
|
def self.available_options
|
@@ -3,7 +3,7 @@ module Fastlane
|
|
3
3
|
class AndroidGetAlphaVersionAction < Action
|
4
4
|
def self.run(params)
|
5
5
|
require_relative '../../helper/android/android_version_helper'
|
6
|
-
Fastlane::Helper::Android::VersionHelper.get_alpha_version
|
6
|
+
Fastlane::Helper::Android::VersionHelper.get_alpha_version
|
7
7
|
end
|
8
8
|
|
9
9
|
#####################################################
|
@@ -3,7 +3,7 @@ module Fastlane
|
|
3
3
|
class AndroidGetReleaseVersionAction < Action
|
4
4
|
def self.run(params)
|
5
5
|
require_relative '../../helper/android/android_version_helper'
|
6
|
-
Fastlane::Helper::Android::VersionHelper.get_release_version
|
6
|
+
Fastlane::Helper::Android::VersionHelper.get_release_version
|
7
7
|
end
|
8
8
|
|
9
9
|
#####################################################
|
@@ -14,7 +14,7 @@ module Fastlane
|
|
14
14
|
|
15
15
|
# Confirm
|
16
16
|
message = "Requested Hotfix version: #{new_ver}\n"
|
17
|
-
message << "Branching from: #{prev_ver}\n"
|
17
|
+
message << "Branching from tag: #{prev_ver}\n"
|
18
18
|
|
19
19
|
if params[:skip_confirm]
|
20
20
|
UI.message(message)
|
@@ -50,13 +50,13 @@ module Fastlane
|
|
50
50
|
[
|
51
51
|
FastlaneCore::ConfigItem.new(key: :version_name,
|
52
52
|
env_name: 'FL_ANDROID_HOTFIX_PRECHECKS_VERSION',
|
53
|
-
description: 'The version to
|
53
|
+
description: 'The hotfix version number to create',
|
54
54
|
is_string: true),
|
55
55
|
FastlaneCore::ConfigItem.new(key: :skip_confirm,
|
56
56
|
env_name: 'FL_ANDROID_HOTFIX_PRECHECKS_SKIPCONFIRM',
|
57
57
|
description: 'Skips confirmation',
|
58
|
-
is_string: false, #
|
59
|
-
default_value: false),
|
58
|
+
is_string: false, # Boolean
|
59
|
+
default_value: false),
|
60
60
|
]
|
61
61
|
end
|
62
62
|
|
@@ -5,10 +5,10 @@ module Fastlane
|
|
5
5
|
require_relative '../../helper/android/android_version_helper'
|
6
6
|
require_relative '../../helper/android/android_git_helper'
|
7
7
|
|
8
|
-
release_ver = Fastlane::Helper::Android::VersionHelper.get_release_version
|
9
|
-
alpha_ver = Fastlane::Helper::Android::VersionHelper.get_alpha_version
|
8
|
+
release_ver = Fastlane::Helper::Android::VersionHelper.get_release_version
|
9
|
+
alpha_ver = Fastlane::Helper::Android::VersionHelper.get_alpha_version
|
10
10
|
Fastlane::Helper::GitHelper.create_tag(release_ver[Fastlane::Helper::Android::VersionHelper::VERSION_NAME])
|
11
|
-
Fastlane::Helper::GitHelper.create_tag(alpha_ver[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]) unless
|
11
|
+
Fastlane::Helper::GitHelper.create_tag(alpha_ver[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]) unless alpha_ver.nil? || (params[:tag_alpha] == false)
|
12
12
|
end
|
13
13
|
|
14
14
|
#####################################################
|
@@ -98,7 +98,7 @@ module Fastlane
|
|
98
98
|
|
99
99
|
def self.details
|
100
100
|
'This actions checks the current status of the translations on GlotPress ' \
|
101
|
-
|
101
|
+
'and raises an error if it\'s below the provided threshold'
|
102
102
|
end
|
103
103
|
|
104
104
|
def self.available_options
|
@@ -10,7 +10,7 @@ module Fastlane
|
|
10
10
|
repository = params[:repository]
|
11
11
|
version = params[:version]
|
12
12
|
assets = params[:release_assets]
|
13
|
-
release_notes = params[:release_notes_file_path].nil? ? '' :
|
13
|
+
release_notes = params[:release_notes_file_path].nil? ? '' : File.read(params[:release_notes_file_path])
|
14
14
|
prerelease = params[:prerelease]
|
15
15
|
|
16
16
|
UI.message("Creating draft release #{version} in #{repository}.")
|
@@ -9,14 +9,18 @@ module Fastlane
|
|
9
9
|
create_config(params[:previous_version], params[:version])
|
10
10
|
show_config()
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
update_deliverfile = params[:skip_deliver] == false
|
13
|
+
if update_deliverfile
|
14
|
+
UI.message 'Updating Fastlane deliver file...'
|
15
|
+
Fastlane::Helper::Ios::VersionHelper.update_fastlane_deliver(@new_short_version)
|
16
|
+
UI.message 'Done!'
|
17
|
+
end
|
18
|
+
|
15
19
|
UI.message 'Updating XcConfig...'
|
16
20
|
Fastlane::Helper::Ios::VersionHelper.update_xc_configs(@new_version, @new_short_version, @new_version_internal)
|
17
21
|
UI.message 'Done!'
|
18
22
|
|
19
|
-
Fastlane::Helper::Ios::GitHelper.commit_version_bump(include_deliverfile:
|
23
|
+
Fastlane::Helper::Ios::GitHelper.commit_version_bump(include_deliverfile: update_deliverfile, include_metadata: false)
|
20
24
|
|
21
25
|
UI.message 'Done.'
|
22
26
|
end
|
@@ -34,18 +38,29 @@ module Fastlane
|
|
34
38
|
end
|
35
39
|
|
36
40
|
def self.available_options
|
37
|
-
# Define all options your action supports.
|
38
|
-
|
39
|
-
# Below a few examples
|
40
41
|
[
|
41
|
-
FastlaneCore::ConfigItem.new(
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
42
|
+
FastlaneCore::ConfigItem.new(
|
43
|
+
key: :version,
|
44
|
+
env_name: 'FL_IOS_BUMP_VERSION_HOTFIX_VERSION',
|
45
|
+
description: 'The version of the hotfix',
|
46
|
+
is_string: true
|
47
|
+
),
|
48
|
+
FastlaneCore::ConfigItem.new(
|
49
|
+
key: :previous_version,
|
50
|
+
env_name: 'FL_IOS_BUMP_VERSION_HOTFIX_PREVIOUS_VERSION',
|
51
|
+
description: 'The version to branch from',
|
52
|
+
is_string: true
|
53
|
+
),
|
54
|
+
FastlaneCore::ConfigItem.new(
|
55
|
+
key: :skip_deliver,
|
56
|
+
env_name: 'FL_IOS_BUMP_VERSION_HOTFIX_SKIP_DELIVER',
|
57
|
+
description: 'Skips Deliverfile key update',
|
58
|
+
is_string: false, # Boolean parameter
|
59
|
+
optional: true,
|
60
|
+
# Don't skip the Deliverfile by default. At the time of writing, 2 out of 3 consumers
|
61
|
+
# still have a Deliverfile.
|
62
|
+
default_value: false
|
63
|
+
),
|
49
64
|
]
|
50
65
|
end
|
51
66
|
|
@@ -50,7 +50,7 @@ module Fastlane
|
|
50
50
|
|
51
51
|
if line_count <= 1
|
52
52
|
# Single line output
|
53
|
-
fw.puts("msgid \"#{File.open(@content_file_path, 'r').read}\"")
|
53
|
+
fw.puts("msgid \"#{File.open(@content_file_path, 'r').read.rstrip}\"")
|
54
54
|
else
|
55
55
|
# Multiple line output
|
56
56
|
fw.puts('msgid ""')
|
@@ -12,11 +12,20 @@ module Fastlane
|
|
12
12
|
# @env PROJECT_NAME The name of the directory containing the project code (especially containing the `build.gradle` file)
|
13
13
|
#
|
14
14
|
def self.commit_version_bump
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
require_relative './android_version_helper'
|
16
|
+
if File.exist?(Fastlane::Helper::Android::VersionHelper.version_properties_file)
|
17
|
+
Fastlane::Helper::GitHelper.commit(
|
18
|
+
message: 'Bump version number',
|
19
|
+
files: File.join(ENV['PROJECT_ROOT_FOLDER'], 'version.properties'),
|
20
|
+
push: true
|
21
|
+
)
|
22
|
+
else
|
23
|
+
Fastlane::Helper::GitHelper.commit(
|
24
|
+
message: 'Bump version number',
|
25
|
+
files: File.join(ENV['PROJECT_ROOT_FOLDER'], ENV['PROJECT_NAME'], 'build.gradle'),
|
26
|
+
push: true
|
27
|
+
)
|
28
|
+
end
|
20
29
|
end
|
21
30
|
|
22
31
|
# Calls the `tools/update-translations.sh` script from the project repo, then lint them using the provided gradle task
|
@@ -38,14 +38,13 @@ module Fastlane
|
|
38
38
|
"#{vp[MAJOR_NUMBER]}.#{vp[MINOR_NUMBER]}.#{vp[HOTFIX_NUMBER]}"
|
39
39
|
end
|
40
40
|
|
41
|
-
# Extract the version name and code from the
|
42
|
-
# or for the defaultConfig if `HAS_ALPHA_VERSION` is not defined.
|
43
|
-
#
|
44
|
-
# @env HAS_ALPHA_VERSION If set (with any value), indicates that the project uses `vanilla` flavor.
|
41
|
+
# Extract the version name and code from the release version of the app from `version.properties file`
|
45
42
|
#
|
46
43
|
# @return [Hash] A hash with 2 keys "name" and "code" containing the extracted version name and code, respectively
|
47
44
|
#
|
48
45
|
def self.get_release_version
|
46
|
+
return get_version_from_properties() if File.exist?(version_properties_file)
|
47
|
+
|
49
48
|
section = ENV['HAS_ALPHA_VERSION'].nil? ? 'defaultConfig' : 'vanilla {'
|
50
49
|
gradle_path = self.gradle_path
|
51
50
|
name = get_version_name_from_gradle_file(gradle_path, section)
|
@@ -53,12 +52,37 @@ module Fastlane
|
|
53
52
|
return { VERSION_NAME => name, VERSION_CODE => code }
|
54
53
|
end
|
55
54
|
|
56
|
-
|
55
|
+
def self.version_properties_file
|
56
|
+
File.join(ENV['PROJECT_ROOT_FOLDER'] || '.', 'version.properties')
|
57
|
+
end
|
58
|
+
|
59
|
+
# Extract the version name and code from the `version.properties` file in the project root
|
60
|
+
#
|
61
|
+
# @param [Boolean] is_alpha true if the alpha version should be returned, false otherwise
|
62
|
+
#
|
63
|
+
# @return [Hash] A hash with 2 keys "name" and "code" containing the extracted version name and code, respectively
|
64
|
+
#
|
65
|
+
def self.get_version_from_properties(is_alpha: false)
|
66
|
+
return nil unless File.exist?(version_properties_file)
|
67
|
+
|
68
|
+
version_name_key = is_alpha ? 'alpha.versionName' : 'versionName'
|
69
|
+
version_code_key = is_alpha ? 'alpha.versionCode' : 'versionCode'
|
70
|
+
|
71
|
+
text = File.read(version_properties_file)
|
72
|
+
name = text.match(/#{version_name_key}=(\S*)/m)&.captures&.first
|
73
|
+
code = text.match(/#{version_code_key}=(\S*)/m)&.captures&.first
|
74
|
+
|
75
|
+
return name.nil? || code.nil? ? nil : { VERSION_NAME => name, VERSION_CODE => code.to_i }
|
76
|
+
end
|
77
|
+
|
78
|
+
# Extract the version name and code from the `version.properties` file in the project root
|
57
79
|
#
|
58
80
|
# @return [Hash] A hash with 2 keys `"name"` and `"code"` containing the extracted version name and code, respectively,
|
59
81
|
# or `nil` if `$HAS_ALPHA_VERSION` is not defined.
|
60
82
|
#
|
61
83
|
def self.get_alpha_version
|
84
|
+
return get_version_from_properties(is_alpha: true) if File.exist?(version_properties_file)
|
85
|
+
|
62
86
|
return nil if ENV['HAS_ALPHA_VERSION'].nil?
|
63
87
|
|
64
88
|
section = 'defaultConfig'
|
@@ -95,8 +119,8 @@ module Fastlane
|
|
95
119
|
# - The final version name corresponds to the beta's versionName, without the `-rc` suffix
|
96
120
|
# - The final version code corresponds to the versionCode for the alpha (or for the beta if alpha_version is nil) incremented by one.
|
97
121
|
#
|
98
|
-
# @param [Hash] beta_version The version hash for the beta
|
99
|
-
# @param [Hash] alpha_version The version hash for the alpha
|
122
|
+
# @param [Hash] beta_version The version hash for the beta, containing values for keys "name" and "code"
|
123
|
+
# @param [Hash] alpha_version The version hash for the alpha, containing values for keys "name" and "code",
|
100
124
|
# or `nil` if no alpha version to consider.
|
101
125
|
#
|
102
126
|
# @return [Hash] A version hash with keys "name" and "code", containing the version name and code to use for final release.
|
@@ -258,7 +282,7 @@ module Fastlane
|
|
258
282
|
#
|
259
283
|
def self.bump_version_release
|
260
284
|
# Bump release
|
261
|
-
current_version = get_release_version
|
285
|
+
current_version = self.get_release_version
|
262
286
|
UI.message("Current version: #{current_version[VERSION_NAME]}")
|
263
287
|
new_version = calc_next_release_base_version(current_version)
|
264
288
|
UI.message("New version: #{new_version[VERSION_NAME]}")
|
@@ -267,15 +291,30 @@ module Fastlane
|
|
267
291
|
return verified_version
|
268
292
|
end
|
269
293
|
|
270
|
-
# Update the `
|
294
|
+
# Update the `version.properties` file with new `versionName` and `versionCode` values
|
271
295
|
#
|
272
|
-
# @param [Hash] new_version_beta The version hash for the beta
|
273
|
-
# @param [Hash] new_version_alpha The version hash for the alpha
|
274
|
-
# @env HAS_ALPHA_VERSION If set (with any value), indicates that the project uses `vanilla` flavor.
|
296
|
+
# @param [Hash] new_version_beta The version hash for the beta, containing values for keys "name" and "code"
|
297
|
+
# @param [Hash] new_version_alpha The version hash for the alpha , containing values for keys "name" and "code"
|
275
298
|
#
|
276
299
|
def self.update_versions(new_version_beta, new_version_alpha)
|
277
|
-
|
278
|
-
|
300
|
+
if File.exist?(version_properties_file)
|
301
|
+
replacements = {
|
302
|
+
versionName: (new_version_beta || {})[VERSION_NAME],
|
303
|
+
versionCode: (new_version_beta || {})[VERSION_CODE],
|
304
|
+
'alpha.versionName': (new_version_alpha || {})[VERSION_NAME],
|
305
|
+
'alpha.versionCode': (new_version_alpha || {})[VERSION_CODE]
|
306
|
+
}
|
307
|
+
content = File.read(version_properties_file)
|
308
|
+
content.gsub!(/^(.*) ?=.*$/) do |line|
|
309
|
+
key = Regexp.last_match(1).to_sym
|
310
|
+
value = replacements[key]
|
311
|
+
value.nil? ? line : "#{key}=#{value}"
|
312
|
+
end
|
313
|
+
File.write(version_properties_file, content)
|
314
|
+
else
|
315
|
+
self.update_version(new_version_beta, ENV['HAS_ALPHA_VERSION'].nil? ? 'defaultConfig' : 'vanilla {')
|
316
|
+
self.update_version(new_version_alpha, 'defaultConfig') unless new_version_alpha.nil?
|
317
|
+
end
|
279
318
|
end
|
280
319
|
|
281
320
|
# Compute the name of the previous hotfix version.
|
@@ -337,6 +376,37 @@ module Fastlane
|
|
337
376
|
return parts
|
338
377
|
end
|
339
378
|
|
379
|
+
# Ensure that a version string is correctly formatted (that is, each of its parts is a number) and returns the 2-parts version number
|
380
|
+
#
|
381
|
+
# @param [String] version The version string to verify
|
382
|
+
#
|
383
|
+
# @return [String] The "major.minor" version string, only with the first 2 components
|
384
|
+
# @raise [UserError] If any of the parts of the version string is not a number
|
385
|
+
#
|
386
|
+
def self.verify_version(version)
|
387
|
+
v_parts = get_version_parts(version)
|
388
|
+
|
389
|
+
v_parts.each do |part|
|
390
|
+
UI.user_error!('Version value can only contains numbers.') unless is_int?(part)
|
391
|
+
end
|
392
|
+
|
393
|
+
"#{v_parts[MAJOR_NUMBER]}.#{v_parts[MINOR_NUMBER]}"
|
394
|
+
end
|
395
|
+
|
396
|
+
# Check if a string is an integer.
|
397
|
+
#
|
398
|
+
# @param [String] string The string to test
|
399
|
+
#
|
400
|
+
# @return [Bool] true if the string is representing an integer value, false if not
|
401
|
+
#
|
402
|
+
def self.is_int?(string)
|
403
|
+
true if Integer(string) rescue false
|
404
|
+
end
|
405
|
+
|
406
|
+
#########
|
407
|
+
# Functions to support versioning through build.gradle - can be removed once all projects adopt version.properties
|
408
|
+
########
|
409
|
+
|
340
410
|
# Extract the versionName from a build.gradle file
|
341
411
|
#
|
342
412
|
# @param [String] file_path The path to the `.gradle` file
|
@@ -387,33 +457,6 @@ module Fastlane
|
|
387
457
|
return nil
|
388
458
|
end
|
389
459
|
|
390
|
-
# Ensure that a version string is correctly formatted (that is, each of its parts is a number) and returns the 2-parts version number
|
391
|
-
#
|
392
|
-
# @param [String] version The version string to verify
|
393
|
-
#
|
394
|
-
# @return [String] The "major.minor" version string, only with the first 2 components
|
395
|
-
# @raise [UserError] If any of the parts of the version string is not a number
|
396
|
-
#
|
397
|
-
def self.verify_version(version)
|
398
|
-
v_parts = get_version_parts(version)
|
399
|
-
|
400
|
-
v_parts.each do |part|
|
401
|
-
UI.user_error!('Version value can only contains numbers.') unless is_int?(part)
|
402
|
-
end
|
403
|
-
|
404
|
-
"#{v_parts[MAJOR_NUMBER]}.#{v_parts[MINOR_NUMBER]}"
|
405
|
-
end
|
406
|
-
|
407
|
-
# Check if a string is an integer.
|
408
|
-
#
|
409
|
-
# @param [String] string The string to test
|
410
|
-
#
|
411
|
-
# @return [Bool] true if the string is representing an integer value, false if not
|
412
|
-
#
|
413
|
-
def self.is_int? string
|
414
|
-
true if Integer(string) rescue false
|
415
|
-
end
|
416
|
-
|
417
460
|
# The path to the build.gradle file for the project.
|
418
461
|
#
|
419
462
|
# @env PROJECT_ROOT_FOLDER The path to the root of the project (the folder containing the `.git` directory).
|
@@ -36,7 +36,9 @@ module Fastlane
|
|
36
36
|
while continue
|
37
37
|
child_filenames = dir.children.map! { |x| File.basename(x) }
|
38
38
|
|
39
|
-
|
39
|
+
# The first case is for development – where the `.gemspec` is present in the project root
|
40
|
+
# The second case is for production – where there's no `.gemspec`, but the root dir of the plugin is named `fastlane-plugin-wpmreleasetoolkit-{version}`.
|
41
|
+
if child_filenames.include?('fastlane-plugin-wpmreleasetoolkit.gemspec') || File.basename(dir).start_with?('fastlane-plugin-wpmreleasetoolkit-')
|
40
42
|
continue = false
|
41
43
|
else
|
42
44
|
dir = dir.parent
|
@@ -26,12 +26,35 @@ module Fastlane
|
|
26
26
|
# @return [Integer] The percentage of the translated strings.
|
27
27
|
#
|
28
28
|
def self.get_translation_status(data:, language_code:)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
# The status is parsed from the GlotPress project page.
|
30
|
+
# The row can be identified by the language code and the progress is in the column identified by the class "stats percent".
|
31
|
+
# When the progress is above 90%, a special badge is added.
|
32
|
+
# Because of the way the HTML is organized, this regex matches content spawned on three or four lines
|
33
|
+
# Regex:
|
34
|
+
# ^ : start of a line
|
35
|
+
# \s* : any space
|
36
|
+
# <strong><a href=".*\/#{language_code}\/default\/"> : This link contains the language code of that line in the HTML table, so it's a reliable match
|
37
|
+
# .* : any character. The language name should be here, but it can be less reliable than the language code as a match
|
38
|
+
# <\/strong> : tag closure
|
39
|
+
# \n : new line
|
40
|
+
# (?: : match the following. This starts the "morethan90" special badge, which we expect to exist zero or one times (see the closure of this part of the regex).
|
41
|
+
# \s* : any space
|
42
|
+
# <span class="bubble morethan90"> : Start of the special badge
|
43
|
+
# \d\d\d?% : 2 or 3 digits and the percentage char
|
44
|
+
# <\/span>\n : Special badge closure and new line
|
45
|
+
# )? : end of the "morethan90" special badge section. Expect this zero or one times.
|
46
|
+
# \s*<\/td>\n : column closure tag. Any space before of it are ok. Expect new line after it.
|
47
|
+
# \s* : any space
|
48
|
+
# <td class="stats percent"> : This is the tag which can be used to extract the progress
|
49
|
+
# ([0-9]+) : progress is the first group
|
50
|
+
# %<\/td> : tag closure
|
51
|
+
regex = "^\\s*<strong><a href=\".*\\/#{language_code}\\/default\\/\">.*<\\/strong>\\n"
|
52
|
+
regex += '(?:\s*<span class="bubble morethan90">\d\d\d?%<\/span>\n)?\s*<\/td>\n\s*<td class="stats percent">([0-9]+)%<\/td>$'
|
33
53
|
|
34
|
-
|
54
|
+
# 1. Merge the array into a single string.
|
55
|
+
# 2. Match the info and extract the value in group 1.
|
56
|
+
# 3. Convert to integer.
|
57
|
+
data.join("\n").match(/#{regex}/)[1].to_i
|
35
58
|
end
|
36
59
|
|
37
60
|
# Extract the number of strings which are in the given status.
|
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:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lorenzo Mattei
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diffy
|
@@ -84,16 +84,22 @@ dependencies:
|
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '12.3'
|
90
|
+
- - "<"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '14.0'
|
90
93
|
type: :runtime
|
91
94
|
prerelease: false
|
92
95
|
version_requirements: !ruby/object:Gem::Requirement
|
93
96
|
requirements:
|
94
|
-
- - "
|
97
|
+
- - ">="
|
95
98
|
- !ruby/object:Gem::Version
|
96
99
|
version: '12.3'
|
100
|
+
- - "<"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '14.0'
|
97
103
|
- !ruby/object:Gem::Dependency
|
98
104
|
name: rake-compiler
|
99
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -318,6 +324,20 @@ dependencies:
|
|
318
324
|
- - "~>"
|
319
325
|
- !ruby/object:Gem::Version
|
320
326
|
version: '4.1'
|
327
|
+
- !ruby/object:Gem::Dependency
|
328
|
+
name: cocoapods
|
329
|
+
requirement: !ruby/object:Gem::Requirement
|
330
|
+
requirements:
|
331
|
+
- - "~>"
|
332
|
+
- !ruby/object:Gem::Version
|
333
|
+
version: '1.10'
|
334
|
+
type: :development
|
335
|
+
prerelease: false
|
336
|
+
version_requirements: !ruby/object:Gem::Requirement
|
337
|
+
requirements:
|
338
|
+
- - "~>"
|
339
|
+
- !ruby/object:Gem::Version
|
340
|
+
version: '1.10'
|
321
341
|
description:
|
322
342
|
email: lore.mattei@gmail.com
|
323
343
|
executables:
|