fastlane-plugin-wpmreleasetoolkit 1.3.0 → 1.3.1
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 +6 -6
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_prechecks.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_tag_build.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb +31 -11
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/glotpress_helper.rb +28 -5
- data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b71ab5451b2a1bee74b6dd874e20e478d03501fe4ed86124bb4f4d0ffe6a07eb
|
4
|
+
data.tar.gz: c2cd6dd78f92ac8ff85d54f0f778461213eab8aa748a0654290385bc99989544
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb16735f4f4f54835ce9873cd11f7f62f04f6dfd194474ab78c5f5e6408281306367c90cb85fcc036bb6845a1ace13241cba07af56ded24d8fb50ed8d3debf17
|
7
|
+
data.tar.gz: 38fa14c33229c990a6e1f42062d644da704d89af6fd7dae2be5d3d2f749de684747f7ce56f976fad7514fc4940253ff66aec94ff09498e6a3eaf82f5f9aa49f6
|
@@ -14,18 +14,18 @@ module Fastlane
|
|
14
14
|
app = params[:app]
|
15
15
|
|
16
16
|
# Check versions
|
17
|
-
release_version = Fastlane::Helper::Android::VersionHelper.get_release_version(app)
|
17
|
+
release_version = Fastlane::Helper::Android::VersionHelper.get_release_version(product_name: app)
|
18
18
|
message = "[#{app}] The following current version has been detected: #{release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}\n"
|
19
19
|
alpha_release_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app)
|
20
20
|
message << "[#{app}] The following Alpha version has been detected: #{alpha_release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}\n" unless alpha_release_version.nil?
|
21
21
|
|
22
22
|
# Check branch
|
23
|
-
app_version = Fastlane::Helper::Android::VersionHelper.get_public_version
|
23
|
+
app_version = Fastlane::Helper::Android::VersionHelper.get_public_version(app)
|
24
24
|
UI.user_error!("#{message}Release branch for version #{app_version} doesn't exist. Abort.") unless !params[:base_version].nil? || Fastlane::Helper::GitHelper.checkout_and_pull(release: app_version)
|
25
25
|
|
26
26
|
# Check user overwrite
|
27
27
|
unless params[:base_version].nil?
|
28
|
-
overwrite_version = get_user_build_version(params[:base_version], message)
|
28
|
+
overwrite_version = get_user_build_version(product_name: app, version: params[:base_version], message: message)
|
29
29
|
release_version = overwrite_version[0]
|
30
30
|
alpha_release_version = overwrite_version[1]
|
31
31
|
end
|
@@ -49,11 +49,11 @@ module Fastlane
|
|
49
49
|
[next_beta_version, next_alpha_version]
|
50
50
|
end
|
51
51
|
|
52
|
-
def self.get_user_build_version(version
|
52
|
+
def self.get_user_build_version(product_name:, version:, message:)
|
53
53
|
UI.user_error!("[#{app}] Release branch for version #{version} doesn't exist. Abort.") unless Fastlane::Helper::GitHelper.checkout_and_pull(release: version)
|
54
|
-
release_version = Fastlane::Helper::Android::VersionHelper.get_release_version
|
54
|
+
release_version = Fastlane::Helper::Android::VersionHelper.get_release_version(product_name: product_name)
|
55
55
|
message << "#{app}] Looking at branch release/#{version} as requested by user. Detected version: #{release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}.\n"
|
56
|
-
alpha_release_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version
|
56
|
+
alpha_release_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version(product_name)
|
57
57
|
message << "and Alpha Version: #{alpha_release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}\n" unless alpha_release_version.nil?
|
58
58
|
[release_version, alpha_release_version]
|
59
59
|
end
|
@@ -11,7 +11,7 @@ module Fastlane
|
|
11
11
|
|
12
12
|
app = params[:app]
|
13
13
|
message = ''
|
14
|
-
beta_version = Fastlane::Helper::Android::VersionHelper.get_release_version(app) unless !params[:beta] && !params[:final]
|
14
|
+
beta_version = Fastlane::Helper::Android::VersionHelper.get_release_version(product_name: app) unless !params[:beta] && !params[:final]
|
15
15
|
alpha_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app) if params[:alpha]
|
16
16
|
|
17
17
|
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)
|
@@ -14,7 +14,7 @@ module Fastlane
|
|
14
14
|
UI.user_error!('This is not a release branch. Abort.') unless other_action.git_branch.start_with?('release/')
|
15
15
|
|
16
16
|
version = Fastlane::Helper::Android::VersionHelper.get_public_version(params[:app])
|
17
|
-
message = "Finalizing release: #{version}\n"
|
17
|
+
message = "Finalizing #{params[:app]} release: #{version}\n"
|
18
18
|
if params[:skip_confirm]
|
19
19
|
UI.message(message)
|
20
20
|
else
|
@@ -7,7 +7,7 @@ module Fastlane
|
|
7
7
|
|
8
8
|
app = ENV['PROJECT_NAME'].nil? ? params[:app] : ENV['PROJECT_NAME']
|
9
9
|
|
10
|
-
release_ver = Fastlane::Helper::Android::VersionHelper.get_release_version(app)
|
10
|
+
release_ver = Fastlane::Helper::Android::VersionHelper.get_release_version(product_name: app)
|
11
11
|
alpha_ver = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app)
|
12
12
|
Fastlane::Helper::GitHelper.create_tag(release_ver[Fastlane::Helper::Android::VersionHelper::VERSION_NAME])
|
13
13
|
Fastlane::Helper::GitHelper.create_tag(alpha_ver[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]) unless alpha_ver.nil? || (params[:tag_alpha] == false)
|
@@ -42,7 +42,7 @@ module Fastlane
|
|
42
42
|
|
43
43
|
# Extract the version name and code from the release version of the app from `version.properties file`
|
44
44
|
#
|
45
|
-
# @param [String]
|
45
|
+
# @param [String] product_name The name of the app to be used for beta and alpha version update
|
46
46
|
#
|
47
47
|
# @return [Hash] A hash with 2 keys "name" and "code" containing the extracted version name and code, respectively
|
48
48
|
#
|
@@ -70,8 +70,9 @@ module Fastlane
|
|
70
70
|
# @return [Hash] A hash with 2 keys "name" and "code" containing the extracted version name and code, respectively
|
71
71
|
#
|
72
72
|
def self.get_version_from_properties(product_name:, is_alpha: false)
|
73
|
-
|
74
|
-
|
73
|
+
alpha_variant = is_alpha ? alpha_flavor_name : nil
|
74
|
+
version_name_key = [product_name, alpha_variant, 'versionName'].compact.join('.')
|
75
|
+
version_code_key = [product_name, alpha_variant, 'versionCode'].compact.join('.')
|
75
76
|
|
76
77
|
properties_file_path = File.join(ENV['PROJECT_ROOT_FOLDER'] || '.', 'version.properties')
|
77
78
|
|
@@ -90,6 +91,22 @@ module Fastlane
|
|
90
91
|
end
|
91
92
|
end
|
92
93
|
|
94
|
+
# Returns the name of the flavor used for alpha builds
|
95
|
+
#
|
96
|
+
# @env HAS_ALPHA_VERSION Should contain the name of the flavor used for alpha
|
97
|
+
#
|
98
|
+
# @return [String] The flavor name as provided by the env var, defaulting to `zalpha` if the env var
|
99
|
+
# is not set or is set to '1' ('boolean' value used in legacy call sites)
|
100
|
+
def self.alpha_flavor_name
|
101
|
+
# TODO: Have each fastlane action which depends on this take the alpha flavor name as ConfigItem/parameter
|
102
|
+
# explicitly instead (and get rid of the HAS_ALPHA_VERSION global / env var after that)
|
103
|
+
|
104
|
+
# For now we pass the alpha flavor name by reusing the HAS_ALPHA_VERSION env var.
|
105
|
+
return ENV['HAS_ALPHA_VERSION'] if ENV['HAS_ALPHA_VERSION'] && ENV['HAS_ALPHA_VERSION'] != '1'
|
106
|
+
|
107
|
+
'zalpha' # Default value if HAS_ALPHA_VERSION is not set or hasn't been updated at call site to the flavor name instead of '1'
|
108
|
+
end
|
109
|
+
|
93
110
|
# Extract the version name and code from the `version.properties` file in the project root
|
94
111
|
#
|
95
112
|
# @param [String] app The name of the app to be used for beta and alpha version update
|
@@ -319,17 +336,20 @@ module Fastlane
|
|
319
336
|
if properties_file_exists
|
320
337
|
new_version_name_beta_key = "#{app}.versionName"
|
321
338
|
new_version_code_beta_key = "#{app}.versionCode"
|
322
|
-
new_version_name_alpha_key = "#{app}.alpha.versionName"
|
323
|
-
new_version_code_alpha_key = "#{app}.alpha.versionCode"
|
324
339
|
Action.sh('./gradlew', 'updateVersionProperties', "-Pkey=#{new_version_name_beta_key}", "-Pvalue=#{new_version_beta[VERSION_NAME]}")
|
325
340
|
Action.sh('./gradlew', 'updateVersionProperties', "-Pkey=#{new_version_code_beta_key}", "-Pvalue=#{new_version_beta[VERSION_CODE]}")
|
326
|
-
Action.sh('./gradlew', 'updateVersionProperties', "-Pkey=#{new_version_name_alpha_key}", "-Pvalue=#{new_version_alpha[VERSION_NAME]}") unless new_version_alpha.nil?
|
327
|
-
Action.sh('./gradlew', 'updateVersionProperties', "-Pkey=#{new_version_code_alpha_key}", "-Pvalue=#{new_version_alpha[VERSION_CODE]}") unless new_version_alpha.nil?
|
328
|
-
return
|
329
|
-
end
|
330
341
|
|
331
|
-
|
332
|
-
|
342
|
+
unless new_version_alpha.nil?
|
343
|
+
new_version_name_alpha_key = "#{app}.#{alpha_flavor_name}.versionName"
|
344
|
+
new_version_code_alpha_key = "#{app}.#{alpha_flavor_name}.versionCode"
|
345
|
+
|
346
|
+
Action.sh('./gradlew', 'updateVersionProperties', "-Pkey=#{new_version_name_alpha_key}", "-Pvalue=#{new_version_alpha[VERSION_NAME]}") unless new_version_alpha.nil?
|
347
|
+
Action.sh('./gradlew', 'updateVersionProperties', "-Pkey=#{new_version_code_alpha_key}", "-Pvalue=#{new_version_alpha[VERSION_CODE]}") unless new_version_alpha.nil?
|
348
|
+
end
|
349
|
+
else
|
350
|
+
self.update_version(new_version_beta, ENV['HAS_ALPHA_VERSION'].nil? ? 'defaultConfig' : 'vanilla {')
|
351
|
+
self.update_version(new_version_alpha, 'defaultConfig') unless new_version_alpha.nil?
|
352
|
+
end
|
333
353
|
end
|
334
354
|
|
335
355
|
# Compute the name of the previous hotfix version.
|
@@ -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: 1.3.
|
4
|
+
version: 1.3.1
|
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-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diffy
|