fastlane-plugin-wpmreleasetoolkit 1.2.0 → 1.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 +12 -6
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_prechecks.rb +11 -5
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_beta.rb +24 -24
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_final_release.rb +25 -22
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_hotfix.rb +20 -22
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_release.rb +29 -38
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_codefreeze_prechecks.rb +14 -7
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_completecodefreeze_prechecks.rb +8 -2
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_current_branch_is_hotfix.rb +9 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb +5 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_alpha_version.rb +7 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_app_version.rb +7 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_release_version.rb +7 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_tag_build.rb +9 -3
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_git_helper.rb +14 -5
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb +104 -46
- 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: ee442d259b9c2e9f6ade7505aa2a7cf4a87d01e13ae68abc6d93d1b45b67b931
|
4
|
+
data.tar.gz: caca4af2ab1e2d1b973c199a8a2bf2907f21403fa862e1439047b3740471a8da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0a43dc1b67ce99bb8afb213bf0826fa51c6241ebc4ab406c885d37dcfb5821b6a4fd7d0b23dcb2005d42efd14f07af59b4cc6401738b5de10e1b0bc8cce0d56
|
7
|
+
data.tar.gz: 3acc819e9b7cc00eb406fbae062910d638bdc799fbc26e53f20d6c07b51bdd1a20ddaa41b83dcc20b323bc3cd333ea93e5f365494792e8ec7f47a8abdf852f22
|
@@ -11,11 +11,13 @@ module Fastlane
|
|
11
11
|
# Checkout develop and update
|
12
12
|
Fastlane::Helper::GitHelper.checkout_and_pull('develop')
|
13
13
|
|
14
|
+
app = params[:app]
|
15
|
+
|
14
16
|
# Check versions
|
15
|
-
release_version = Fastlane::Helper::Android::VersionHelper.get_release_version
|
16
|
-
message = "The following current version has been detected: #{release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}\n"
|
17
|
-
alpha_release_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version
|
18
|
-
message << "The following Alpha version has been detected: #{alpha_release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}\n" unless alpha_release_version.nil?
|
17
|
+
release_version = Fastlane::Helper::Android::VersionHelper.get_release_version(app)
|
18
|
+
message = "[#{app}] The following current version has been detected: #{release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}\n"
|
19
|
+
alpha_release_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app)
|
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?
|
19
21
|
|
20
22
|
# Check branch
|
21
23
|
app_version = Fastlane::Helper::Android::VersionHelper.get_public_version
|
@@ -48,9 +50,9 @@ module Fastlane
|
|
48
50
|
end
|
49
51
|
|
50
52
|
def self.get_user_build_version(version, message)
|
51
|
-
UI.user_error!("Release branch for version #{version} doesn't exist. Abort.") unless Fastlane::Helper::GitHelper.checkout_and_pull(release: version)
|
53
|
+
UI.user_error!("[#{app}] Release branch for version #{version} doesn't exist. Abort.") unless Fastlane::Helper::GitHelper.checkout_and_pull(release: version)
|
52
54
|
release_version = Fastlane::Helper::Android::VersionHelper.get_release_version
|
53
|
-
message << "Looking at branch release/#{version} as requested by user. Detected version: #{release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}.\n"
|
55
|
+
message << "#{app}] Looking at branch release/#{version} as requested by user. Detected version: #{release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}.\n"
|
54
56
|
alpha_release_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version
|
55
57
|
message << "and Alpha Version: #{alpha_release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}\n" unless alpha_release_version.nil?
|
56
58
|
[release_version, alpha_release_version]
|
@@ -80,6 +82,10 @@ module Fastlane
|
|
80
82
|
description: 'Skips confirmation',
|
81
83
|
is_string: false, # true: verifies the input is a string, false: every kind of value
|
82
84
|
default_value: false), # the default value if the user didn't provide one
|
85
|
+
FastlaneCore::ConfigItem.new(key: :app,
|
86
|
+
env_name: 'PROJECT_NAME',
|
87
|
+
description: 'The name of the app to get the release version for',
|
88
|
+
is_string: true), # true: verifies the input is a string, false: every kind of value
|
83
89
|
]
|
84
90
|
end
|
85
91
|
|
@@ -3,20 +3,22 @@ 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
|
|
12
|
+
app = params[:app]
|
11
13
|
message = ''
|
12
|
-
beta_version = Fastlane::Helper::Android::VersionHelper.get_release_version() unless !params[:beta] && !params[:final]
|
13
|
-
alpha_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version() if params[:alpha]
|
14
|
+
beta_version = Fastlane::Helper::Android::VersionHelper.get_release_version(app) unless !params[:beta] && !params[:final]
|
15
|
+
alpha_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app) if params[:alpha]
|
14
16
|
|
15
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)
|
16
18
|
|
17
|
-
message << "Building version #{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) (for upload to Release Channel)\n" if params[:final]
|
18
|
-
message << "Building version #{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) (for upload to Beta Channel)\n" if params[:beta]
|
19
|
-
message << "Building version #{alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) (for upload to Alpha Channel)\n" if params[:alpha]
|
19
|
+
message << "[#{app}] Building version #{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) (for upload to Release Channel)\n" if params[:final]
|
20
|
+
message << "[#{app}] Building version #{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) (for upload to Beta Channel)\n" if params[:beta]
|
21
|
+
message << "[#{app}] Building version #{alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) (for upload to Alpha Channel)\n" if params[:alpha]
|
20
22
|
|
21
23
|
if params[:skip_confirm]
|
22
24
|
UI.message(message)
|
@@ -62,6 +64,10 @@ module Fastlane
|
|
62
64
|
description: 'True if this is for a final build',
|
63
65
|
is_string: false,
|
64
66
|
default_value: false),
|
67
|
+
FastlaneCore::ConfigItem.new(key: :app,
|
68
|
+
env_name: 'PROJECT_NAME',
|
69
|
+
description: 'The name of the app to get the release version for',
|
70
|
+
is_string: true), # true: verifies the input is a string, false: every kind of value
|
65
71
|
]
|
66
72
|
end
|
67
73
|
|
@@ -8,11 +8,22 @@ module Fastlane
|
|
8
8
|
require_relative '../../helper/android/android_version_helper'
|
9
9
|
|
10
10
|
Fastlane::Helper::GitHelper.ensure_on_branch!('release')
|
11
|
-
|
12
|
-
show_config()
|
11
|
+
app = params[:app]
|
13
12
|
|
14
|
-
|
15
|
-
Fastlane::Helper::Android::VersionHelper.
|
13
|
+
current_version = Fastlane::Helper::Android::VersionHelper.get_release_version(product_name: app)
|
14
|
+
current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app)
|
15
|
+
new_version_beta = Fastlane::Helper::Android::VersionHelper.calc_next_beta_version(current_version, current_version_alpha)
|
16
|
+
new_version_alpha = current_version_alpha.nil? ? nil : Fastlane::Helper::Android::VersionHelper.calc_next_alpha_version(new_version_beta, current_version_alpha)
|
17
|
+
|
18
|
+
vname = Fastlane::Helper::Android::VersionHelper::VERSION_NAME
|
19
|
+
vcode = Fastlane::Helper::Android::VersionHelper::VERSION_CODE
|
20
|
+
UI.message("Current version[#{app}]: #{current_version[vname]}(#{current_version[vcode]})")
|
21
|
+
UI.message("Current alpha version[#{app}]: #{current_version_alpha[vname]}(#{current_version_alpha[vcode]})") unless current_version_alpha.nil?
|
22
|
+
UI.message("New beta version[#{app}]: #{new_version_beta[vname]}(#{new_version_beta[vcode]})")
|
23
|
+
UI.message("New alpha version[#{app}]: #{new_version_alpha[vname]}(#{new_version_alpha[vcode]})") unless current_version_alpha.nil?
|
24
|
+
|
25
|
+
UI.message 'Updating app version...'
|
26
|
+
Fastlane::Helper::Android::VersionHelper.update_versions(app, new_version_beta, new_version_alpha)
|
16
27
|
UI.message 'Done!'
|
17
28
|
|
18
29
|
Fastlane::Helper::Android::GitHelper.commit_version_bump()
|
@@ -23,14 +34,21 @@ module Fastlane
|
|
23
34
|
#####################################################
|
24
35
|
|
25
36
|
def self.description
|
26
|
-
'Bumps the version of the app for a new beta'
|
37
|
+
'Bumps the version of the app for a new beta. Requires the `updateVersionProperties` gradle task to update the keys if you are using a `version.properties` file.'
|
27
38
|
end
|
28
39
|
|
29
40
|
def self.details
|
30
|
-
'Bumps the version of the app for a new beta'
|
41
|
+
'Bumps the version of the app for a new beta. Requires the `updateVersionProperties` gradle task to update the keys if you are using a `version.properties` file.'
|
31
42
|
end
|
32
43
|
|
33
44
|
def self.available_options
|
45
|
+
# Define all options your action supports.
|
46
|
+
[
|
47
|
+
FastlaneCore::ConfigItem.new(key: :app,
|
48
|
+
env_name: 'PROJECT_NAME',
|
49
|
+
description: 'The name of the app to get the release version for',
|
50
|
+
is_string: true), # true: verifies the input is a string, false: every kind of value
|
51
|
+
]
|
34
52
|
end
|
35
53
|
|
36
54
|
def self.output
|
@@ -46,24 +64,6 @@ module Fastlane
|
|
46
64
|
def self.is_supported?(platform)
|
47
65
|
platform == :android
|
48
66
|
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
67
|
end
|
68
68
|
end
|
69
69
|
end
|
data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_final_release.rb
CHANGED
@@ -8,11 +8,20 @@ module Fastlane
|
|
8
8
|
require_relative '../../helper/android/android_version_helper'
|
9
9
|
|
10
10
|
Fastlane::Helper::GitHelper.ensure_on_branch!('release')
|
11
|
-
|
12
|
-
show_config()
|
11
|
+
app = params[:app]
|
13
12
|
|
14
|
-
|
15
|
-
Fastlane::Helper::Android::VersionHelper.
|
13
|
+
current_version = Fastlane::Helper::Android::VersionHelper.get_release_version(product_name: app)
|
14
|
+
current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app)
|
15
|
+
final_version = Fastlane::Helper::Android::VersionHelper.calc_final_release_version(current_version, 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[#{app}]: #{current_version[vname]}(#{current_version[vcode]})")
|
20
|
+
UI.message("Current alpha version[#{app}]: #{current_version_alpha[vname]}(#{current_version_alpha[vcode]})") unless current_version_alpha.nil?
|
21
|
+
UI.message("New release version[#{app}]: #{final_version[vname]}(#{final_version[vcode]})")
|
22
|
+
|
23
|
+
UI.message 'Updating app version...'
|
24
|
+
Fastlane::Helper::Android::VersionHelper.update_versions(app, final_version, current_version_alpha)
|
16
25
|
UI.message 'Done!'
|
17
26
|
|
18
27
|
Fastlane::Helper::Android::GitHelper.commit_version_bump()
|
@@ -23,11 +32,21 @@ module Fastlane
|
|
23
32
|
#####################################################
|
24
33
|
|
25
34
|
def self.description
|
26
|
-
'Bumps the version of the app for a new beta'
|
35
|
+
'Bumps the version of the app for a new beta. Requires the `updateVersionProperties` gradle task to update the keys if you are using a `version.properties` file.'
|
27
36
|
end
|
28
37
|
|
29
38
|
def self.details
|
30
|
-
'Bumps the version of the app for a new beta'
|
39
|
+
'Bumps the version of the app for a new beta. Requires the `updateVersionProperties` gradle task to update the keys if you are using a `version.properties` file.'
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.available_options
|
43
|
+
# Define all options your action supports.
|
44
|
+
[
|
45
|
+
FastlaneCore::ConfigItem.new(key: :app,
|
46
|
+
env_name: 'PROJECT_NAME',
|
47
|
+
description: 'The name of the app to get the release version for',
|
48
|
+
is_string: true), # true: verifies the input is a string, false: every kind of value
|
49
|
+
]
|
31
50
|
end
|
32
51
|
|
33
52
|
def self.authors
|
@@ -37,22 +56,6 @@ module Fastlane
|
|
37
56
|
def self.is_supported?(platform)
|
38
57
|
platform == :android
|
39
58
|
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
59
|
end
|
57
60
|
end
|
58
61
|
end
|
@@ -6,11 +6,21 @@ 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
|
-
|
10
|
+
app = params[:app]
|
11
|
+
|
12
|
+
current_version = Fastlane::Helper::Android::VersionHelper.get_release_version(product_name: app)
|
13
|
+
current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app)
|
14
|
+
new_version = Fastlane::Helper::Android::VersionHelper.calc_next_hotfix_version(params[:version_name], params[:version_code])
|
15
|
+
new_short_version = new_version_name
|
16
|
+
new_release_branch = "release/#{new_short_version}"
|
17
|
+
|
18
|
+
UI.message("Current version[#{app}]: #{current_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{current_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]})")
|
19
|
+
UI.message("New hotfix version[#{app}]: #{new_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{new_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]})")
|
20
|
+
UI.message("Release branch: #{new_release_branch}")
|
21
|
+
|
22
|
+
UI.message 'Updating app version...'
|
23
|
+
Fastlane::Helper::Android::VersionHelper.update_versions(app, new_version, current_version_alpha)
|
14
24
|
UI.message 'Done!'
|
15
25
|
|
16
26
|
Fastlane::Helper::Android::GitHelper.commit_version_bump()
|
@@ -23,11 +33,11 @@ module Fastlane
|
|
23
33
|
#####################################################
|
24
34
|
|
25
35
|
def self.description
|
26
|
-
'Bumps the version of the app
|
36
|
+
'Bumps the version of the app for a new beta. Requires the `updateVersionProperties` gradle task to update the keys if you are using a `version.properties` file.'
|
27
37
|
end
|
28
38
|
|
29
39
|
def self.details
|
30
|
-
'Bumps the version of the app
|
40
|
+
'Bumps the version of the app for a new beta. Requires the `updateVersionProperties` gradle task to update the keys if you are using a `version.properties` file.'
|
31
41
|
end
|
32
42
|
|
33
43
|
def self.available_options
|
@@ -46,6 +56,10 @@ module Fastlane
|
|
46
56
|
env_name: 'FL_ANDROID_BUMP_VERSION_HOTFIX_PREVIOUS_VERSION',
|
47
57
|
description: 'The version to branch from',
|
48
58
|
is_string: true), # the default value if the user didn't provide one
|
59
|
+
FastlaneCore::ConfigItem.new(key: :app,
|
60
|
+
env_name: 'PROJECT_NAME',
|
61
|
+
description: 'The name of the app to get the release version for',
|
62
|
+
is_string: true), # true: verifies the input is a string, false: every kind of value
|
49
63
|
]
|
50
64
|
end
|
51
65
|
|
@@ -56,22 +70,6 @@ module Fastlane
|
|
56
70
|
def self.is_supported?(platform)
|
57
71
|
platform == :android
|
58
72
|
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
73
|
end
|
76
74
|
end
|
77
75
|
end
|
@@ -11,17 +11,31 @@ module Fastlane
|
|
11
11
|
other_action.ensure_git_branch(branch: 'develop')
|
12
12
|
|
13
13
|
# Create new configuration
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
app = params[:app]
|
15
|
+
new_short_version = Fastlane::Helper::Android::VersionHelper.bump_version_release(app)
|
16
|
+
|
17
|
+
current_version = Fastlane::Helper::Android::VersionHelper.get_release_version(product_name: app)
|
18
|
+
current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app)
|
19
|
+
new_version_beta = Fastlane::Helper::Android::VersionHelper.calc_next_release_version(current_version, current_version_alpha)
|
20
|
+
new_version_alpha = current_version_alpha.nil? ? nil : Fastlane::Helper::Android::VersionHelper.calc_next_alpha_version(new_version_beta, current_version_alpha)
|
21
|
+
new_release_branch = "release/#{new_short_version}"
|
22
|
+
|
23
|
+
vname = Fastlane::Helper::Android::VersionHelper::VERSION_NAME
|
24
|
+
vcode = Fastlane::Helper::Android::VersionHelper::VERSION_CODE
|
25
|
+
UI.message("Current version[#{app}]: #{current_version[vname]}(#{current_version[vcode]})")
|
26
|
+
UI.message("Current alpha version[#{app}]: #{current_version_alpha[vname]}(#{current_version_alpha[vcode]})") unless current_version_alpha.nil?
|
27
|
+
UI.message("New beta version[#{app}]: #{new_version_beta[vname]}(#{new_version_beta[vcode]})")
|
28
|
+
UI.message("New alpha version[#{app}]: #{new_version_alpha[vname]}(#{new_version_alpha[vcode]})") unless current_version_alpha.nil?
|
29
|
+
UI.message("New version[#{app}]: #{new_short_version}")
|
30
|
+
UI.message("Release branch: #{new_release_branch}")
|
17
31
|
|
18
32
|
# Update local develop and branch
|
19
33
|
UI.message 'Creating new branch...'
|
20
|
-
Fastlane::Helper::GitHelper.create_branch(
|
34
|
+
Fastlane::Helper::GitHelper.create_branch(new_release_branch, from: 'develop')
|
21
35
|
UI.message 'Done!'
|
22
36
|
|
23
|
-
UI.message 'Updating
|
24
|
-
Fastlane::Helper::Android::VersionHelper.update_versions(
|
37
|
+
UI.message 'Updating app version...'
|
38
|
+
Fastlane::Helper::Android::VersionHelper.update_versions(app, new_version_beta, new_version_alpha)
|
25
39
|
Fastlane::Helper::Android::GitHelper.commit_version_bump()
|
26
40
|
UI.message 'Done.'
|
27
41
|
end
|
@@ -31,14 +45,21 @@ module Fastlane
|
|
31
45
|
#####################################################
|
32
46
|
|
33
47
|
def self.description
|
34
|
-
'Bumps the version of the app
|
48
|
+
'Bumps the version of the app for a new beta. Requires the `updateVersionProperties` gradle task to update the keys if you are using a `version.properties` file.'
|
35
49
|
end
|
36
50
|
|
37
51
|
def self.details
|
38
|
-
'Bumps the version of the app
|
52
|
+
'Bumps the version of the app for a new beta. Requires the `updateVersionProperties` gradle task to update the keys if you are using a `version.properties` file.'
|
39
53
|
end
|
40
54
|
|
41
55
|
def self.available_options
|
56
|
+
# Define all options your action supports.
|
57
|
+
[
|
58
|
+
FastlaneCore::ConfigItem.new(key: :app,
|
59
|
+
env_name: 'PROJECT_NAME',
|
60
|
+
description: 'The name of the app to get the release version for',
|
61
|
+
is_string: true), # true: verifies the input is a string, false: every kind of value
|
62
|
+
]
|
42
63
|
end
|
43
64
|
|
44
65
|
def self.output
|
@@ -54,36 +75,6 @@ module Fastlane
|
|
54
75
|
def self.is_supported?(platform)
|
55
76
|
platform == :android
|
56
77
|
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
78
|
end
|
88
79
|
end
|
89
80
|
end
|
@@ -14,18 +14,21 @@ module Fastlane
|
|
14
14
|
# Checkout develop and update
|
15
15
|
Fastlane::Helper::GitHelper.checkout_and_pull('develop')
|
16
16
|
|
17
|
+
app = params[:app]
|
18
|
+
|
17
19
|
# Create versions
|
18
|
-
current_version = Fastlane::Helper::Android::VersionHelper.get_release_version
|
19
|
-
current_alpha_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version
|
20
|
+
current_version = Fastlane::Helper::Android::VersionHelper.get_release_version(product_name: app)
|
21
|
+
current_alpha_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app)
|
20
22
|
next_version = Fastlane::Helper::Android::VersionHelper.calc_next_release_version(current_version, current_alpha_version)
|
21
|
-
next_alpha_version =
|
23
|
+
next_alpha_version = current_alpha_version.nil? ? nil : Fastlane::Helper::Android::VersionHelper.calc_next_alpha_version(next_version, current_alpha_version)
|
22
24
|
|
25
|
+
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
26
|
# Ask user confirmation
|
24
27
|
unless params[:skip_confirm]
|
25
|
-
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 +=
|
28
|
+
confirm_message = "[#{app}]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"
|
29
|
+
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
30
|
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 +=
|
31
|
+
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
32
|
confirm_message += 'Do you want to continue?'
|
30
33
|
UI.user_error!('Aborted by user request') unless UI.confirm(confirm_message)
|
31
34
|
end
|
@@ -34,7 +37,7 @@ module Fastlane
|
|
34
37
|
other_action.ensure_git_status_clean()
|
35
38
|
|
36
39
|
# Return the current version
|
37
|
-
Fastlane::Helper::Android::VersionHelper.get_public_version
|
40
|
+
Fastlane::Helper::Android::VersionHelper.get_public_version(app)
|
38
41
|
end
|
39
42
|
|
40
43
|
#####################################################
|
@@ -57,6 +60,10 @@ module Fastlane
|
|
57
60
|
description: 'Skips confirmation before codefreeze',
|
58
61
|
is_string: false, # true: verifies the input is a string, false: every kind of value
|
59
62
|
default_value: false), # the default value if the user didn't provide one
|
63
|
+
FastlaneCore::ConfigItem.new(key: :app,
|
64
|
+
env_name: 'PROJECT_NAME',
|
65
|
+
description: 'The name of the app to get the release version for',
|
66
|
+
is_string: true), # true: verifies the input is a string, false: every kind of value
|
60
67
|
]
|
61
68
|
end
|
62
69
|
|
data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_completecodefreeze_prechecks.rb
CHANGED
@@ -9,8 +9,10 @@ module Fastlane
|
|
9
9
|
|
10
10
|
UI.user_error!('This is not a release branch. Abort.') unless other_action.git_branch.start_with?('release/')
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
app = params[:app]
|
13
|
+
|
14
|
+
version = Fastlane::Helper::Android::VersionHelper.get_public_version(app)
|
15
|
+
message = "Completing code freeze for: [#{app}]#{version}\n"
|
14
16
|
unless params[:skip_confirm]
|
15
17
|
UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
|
16
18
|
else
|
@@ -42,6 +44,10 @@ module Fastlane
|
|
42
44
|
description: 'Skips confirmation',
|
43
45
|
is_string: false, # true: verifies the input is a string, false: every kind of value
|
44
46
|
default_value: false), # the default value if the user didn't provide one
|
47
|
+
FastlaneCore::ConfigItem.new(key: :app,
|
48
|
+
env_name: 'PROJECT_NAME',
|
49
|
+
description: 'The name of the app to get the release version for',
|
50
|
+
is_string: true), # true: verifies the input is a string, false: every kind of value
|
45
51
|
]
|
46
52
|
end
|
47
53
|
|
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(product_name: params[:app])
|
11
|
+
Fastlane::Helper::Android::VersionHelper.is_hotfix?(version)
|
11
12
|
end
|
12
13
|
|
13
14
|
#####################################################
|
@@ -23,6 +24,13 @@ module Fastlane
|
|
23
24
|
end
|
24
25
|
|
25
26
|
def self.available_options
|
27
|
+
# Define all options your action supports.
|
28
|
+
[
|
29
|
+
FastlaneCore::ConfigItem.new(key: :app,
|
30
|
+
env_name: 'PROJECT_NAME',
|
31
|
+
description: 'The name of the app to get the release version for',
|
32
|
+
is_string: true), # true: verifies the input is a string, false: every kind of value
|
33
|
+
]
|
26
34
|
end
|
27
35
|
|
28
36
|
def self.output
|
@@ -13,7 +13,7 @@ module Fastlane
|
|
13
13
|
|
14
14
|
UI.user_error!('This is not a release branch. Abort.') unless other_action.git_branch.start_with?('release/')
|
15
15
|
|
16
|
-
version = Fastlane::Helper::Android::VersionHelper.get_public_version
|
16
|
+
version = Fastlane::Helper::Android::VersionHelper.get_public_version(params[:app])
|
17
17
|
message = "Finalizing release: #{version}\n"
|
18
18
|
if params[:skip_confirm]
|
19
19
|
UI.message(message)
|
@@ -49,6 +49,10 @@ module Fastlane
|
|
49
49
|
description: 'Skips confirmation',
|
50
50
|
is_string: false, # true: verifies the input is a string, false: every kind of value
|
51
51
|
default_value: false), # the default value if the user didn't provide one
|
52
|
+
FastlaneCore::ConfigItem.new(key: :app,
|
53
|
+
env_name: 'PROJECT_NAME',
|
54
|
+
description: 'The name of the app to get the release version for',
|
55
|
+
is_string: true), # true: verifies the input is a string, false: every kind of value
|
52
56
|
]
|
53
57
|
end
|
54
58
|
|
@@ -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(params[:app])
|
7
7
|
end
|
8
8
|
|
9
9
|
#####################################################
|
@@ -20,6 +20,12 @@ module Fastlane
|
|
20
20
|
|
21
21
|
def self.available_options
|
22
22
|
# Define all options your action supports.
|
23
|
+
[
|
24
|
+
FastlaneCore::ConfigItem.new(key: :app,
|
25
|
+
env_name: 'PROJECT_NAME',
|
26
|
+
description: 'The name of the app to get the release version for',
|
27
|
+
is_string: true), # true: verifies the input is a string, false: every kind of value
|
28
|
+
]
|
23
29
|
end
|
24
30
|
|
25
31
|
def self.output
|
@@ -3,7 +3,7 @@ module Fastlane
|
|
3
3
|
class AndroidGetAppVersionAction < Action
|
4
4
|
def self.run(params)
|
5
5
|
require_relative '../../helper/android/android_version_helper'
|
6
|
-
Fastlane::Helper::Android::VersionHelper.get_public_version
|
6
|
+
Fastlane::Helper::Android::VersionHelper.get_public_version(params[:app])
|
7
7
|
end
|
8
8
|
|
9
9
|
#####################################################
|
@@ -20,6 +20,12 @@ module Fastlane
|
|
20
20
|
|
21
21
|
def self.available_options
|
22
22
|
# Define all options your action supports.
|
23
|
+
[
|
24
|
+
FastlaneCore::ConfigItem.new(key: :app,
|
25
|
+
env_name: 'PROJECT_NAME',
|
26
|
+
description: 'The name of the app to get the release version for',
|
27
|
+
is_string: true), # true: verifies the input is a string, false: every kind of value
|
28
|
+
]
|
23
29
|
end
|
24
30
|
|
25
31
|
def self.output
|
@@ -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(product_name: params[:app])
|
7
7
|
end
|
8
8
|
|
9
9
|
#####################################################
|
@@ -20,6 +20,12 @@ module Fastlane
|
|
20
20
|
|
21
21
|
def self.available_options
|
22
22
|
# Define all options your action supports.
|
23
|
+
[
|
24
|
+
FastlaneCore::ConfigItem.new(key: :app,
|
25
|
+
env_name: 'PROJECT_NAME',
|
26
|
+
description: 'The name of the app to get the release version for',
|
27
|
+
is_string: true), # true: verifies the input is a string, false: every kind of value
|
28
|
+
]
|
23
29
|
end
|
24
30
|
|
25
31
|
def self.output
|
@@ -5,10 +5,12 @@ 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
|
+
app = ENV['PROJECT_NAME'].nil? ? params[:app] : ENV['PROJECT_NAME']
|
9
|
+
|
10
|
+
release_ver = Fastlane::Helper::Android::VersionHelper.get_release_version(app)
|
11
|
+
alpha_ver = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app)
|
10
12
|
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
|
13
|
+
Fastlane::Helper::GitHelper.create_tag(alpha_ver[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]) unless alpha_ver.nil? || (params[:tag_alpha] == false)
|
12
14
|
end
|
13
15
|
|
14
16
|
#####################################################
|
@@ -30,6 +32,10 @@ module Fastlane
|
|
30
32
|
description: 'True to skip tagging the alpha version',
|
31
33
|
is_string: false,
|
32
34
|
default_value: true),
|
35
|
+
FastlaneCore::ConfigItem.new(key: :app,
|
36
|
+
env_name: 'PROJECT_NAME',
|
37
|
+
description: 'The name of the app to get the release version for',
|
38
|
+
is_string: true), # true: verifies the input is a string, false: every kind of value
|
33
39
|
]
|
34
40
|
end
|
35
41
|
|
@@ -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 Fastlane::Helper::Android::VersionHelper.properties_file_exists
|
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
|
@@ -26,26 +26,29 @@ module Fastlane
|
|
26
26
|
# "1.2" # Assuming build.gradle contains versionName "1.2.0"
|
27
27
|
# "1.2.3" # Assuming build.gradle contains versionName "1.2.3"
|
28
28
|
#
|
29
|
+
# @param [String] app The name of the app to be used for beta and alpha version update
|
30
|
+
#
|
29
31
|
# @return [String] The public-facing version number, extracted from the `versionName` of the `build.gradle` file.
|
30
32
|
# - If this version is a hotfix (more than 2 parts and 3rd part is non-zero), returns the "X.Y.Z" formatted string
|
31
33
|
# - Otherwise (not a hotfix / 3rd part of version is 0), returns "X.Y" formatted version number
|
32
34
|
#
|
33
|
-
def self.get_public_version
|
34
|
-
version = get_release_version
|
35
|
+
def self.get_public_version(app)
|
36
|
+
version = get_release_version(product_name: app)
|
35
37
|
vp = get_version_parts(version[VERSION_NAME])
|
36
38
|
return "#{vp[MAJOR_NUMBER]}.#{vp[MINOR_NUMBER]}" unless is_hotfix?(version)
|
37
39
|
|
38
40
|
"#{vp[MAJOR_NUMBER]}.#{vp[MINOR_NUMBER]}.#{vp[HOTFIX_NUMBER]}"
|
39
41
|
end
|
40
42
|
|
41
|
-
# Extract the version name and code from the
|
42
|
-
# or for the defaultConfig if `HAS_ALPHA_VERSION` is not defined.
|
43
|
+
# Extract the version name and code from the release version of the app from `version.properties file`
|
43
44
|
#
|
44
|
-
# @
|
45
|
+
# @param [String] app The name of the app to be used for beta and alpha version update
|
45
46
|
#
|
46
47
|
# @return [Hash] A hash with 2 keys "name" and "code" containing the extracted version name and code, respectively
|
47
48
|
#
|
48
|
-
def self.get_release_version
|
49
|
+
def self.get_release_version(product_name:)
|
50
|
+
return get_version_from_properties(product_name: product_name) if properties_file_exists
|
51
|
+
|
49
52
|
section = ENV['HAS_ALPHA_VERSION'].nil? ? 'defaultConfig' : 'vanilla {'
|
50
53
|
gradle_path = self.gradle_path
|
51
54
|
name = get_version_name_from_gradle_file(gradle_path, section)
|
@@ -53,12 +56,50 @@ module Fastlane
|
|
53
56
|
return { VERSION_NAME => name, VERSION_CODE => code }
|
54
57
|
end
|
55
58
|
|
56
|
-
|
59
|
+
def self.properties_file_exists
|
60
|
+
properties_file_path = File.join(ENV['PROJECT_ROOT_FOLDER'] || '.', 'version.properties')
|
61
|
+
|
62
|
+
return File.exist?(properties_file_path)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Extract the version name and code from the `version.properties` file in the project root
|
66
|
+
#
|
67
|
+
# @param [String] product_name The name of the app to extract the version from e.g. wordpress, simplenote
|
68
|
+
# @param [Boolean] is_alpha true if the alpha version should be returned, false otherwise
|
69
|
+
#
|
70
|
+
# @return [Hash] A hash with 2 keys "name" and "code" containing the extracted version name and code, respectively
|
71
|
+
#
|
72
|
+
def self.get_version_from_properties(product_name:, is_alpha: false)
|
73
|
+
version_name_key = "#{product_name}.#{is_alpha ? 'alpha.' : ''}versionName"
|
74
|
+
version_code_key = "#{product_name}.#{is_alpha ? 'alpha.' : ''}versionCode"
|
75
|
+
|
76
|
+
properties_file_path = File.join(ENV['PROJECT_ROOT_FOLDER'] || '.', 'version.properties')
|
77
|
+
|
78
|
+
return nil unless File.exist?(properties_file_path)
|
79
|
+
|
80
|
+
File.open(properties_file_path, 'r') do |f|
|
81
|
+
text = f.read
|
82
|
+
name = text.match(/#{version_name_key}=(\S*)/m)&.captures&.first
|
83
|
+
code = text.match(/#{version_code_key}=(\S*)/m)&.captures&.first
|
84
|
+
|
85
|
+
f.close
|
86
|
+
|
87
|
+
return nil if name.nil? || code.nil?
|
88
|
+
|
89
|
+
return { VERSION_NAME => name, VERSION_CODE => code.to_i }
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# Extract the version name and code from the `version.properties` file in the project root
|
94
|
+
#
|
95
|
+
# @param [String] app The name of the app to be used for beta and alpha version update
|
57
96
|
#
|
58
97
|
# @return [Hash] A hash with 2 keys `"name"` and `"code"` containing the extracted version name and code, respectively,
|
59
98
|
# or `nil` if `$HAS_ALPHA_VERSION` is not defined.
|
60
99
|
#
|
61
|
-
def self.get_alpha_version
|
100
|
+
def self.get_alpha_version(app)
|
101
|
+
return get_version_from_properties(product_name: app, is_alpha: true) if properties_file_exists
|
102
|
+
|
62
103
|
return nil if ENV['HAS_ALPHA_VERSION'].nil?
|
63
104
|
|
64
105
|
section = 'defaultConfig'
|
@@ -95,8 +136,8 @@ module Fastlane
|
|
95
136
|
# - The final version name corresponds to the beta's versionName, without the `-rc` suffix
|
96
137
|
# - The final version code corresponds to the versionCode for the alpha (or for the beta if alpha_version is nil) incremented by one.
|
97
138
|
#
|
98
|
-
# @param [Hash] beta_version The version hash for the beta
|
99
|
-
# @param [Hash] alpha_version The version hash for the alpha
|
139
|
+
# @param [Hash] beta_version The version hash for the beta, containing values for keys "name" and "code"
|
140
|
+
# @param [Hash] alpha_version The version hash for the alpha, containing values for keys "name" and "code",
|
100
141
|
# or `nil` if no alpha version to consider.
|
101
142
|
#
|
102
143
|
# @return [Hash] A version hash with keys "name" and "code", containing the version name and code to use for final release.
|
@@ -254,11 +295,12 @@ module Fastlane
|
|
254
295
|
|
255
296
|
# Prints the current and next release version names to stdout, then returns the next release version
|
256
297
|
#
|
298
|
+
# @param [String] app The name of the app to be used for beta and alpha version update
|
257
299
|
# @return [String] The next release version name to use after bumping the currently used release version.
|
258
300
|
#
|
259
|
-
def self.bump_version_release
|
301
|
+
def self.bump_version_release(app)
|
260
302
|
# Bump release
|
261
|
-
current_version = get_release_version()
|
303
|
+
current_version = get_release_version(product_name: app)
|
262
304
|
UI.message("Current version: #{current_version[VERSION_NAME]}")
|
263
305
|
new_version = calc_next_release_base_version(current_version)
|
264
306
|
UI.message("New version: #{new_version[VERSION_NAME]}")
|
@@ -267,13 +309,25 @@ module Fastlane
|
|
267
309
|
return verified_version
|
268
310
|
end
|
269
311
|
|
270
|
-
# Update the `
|
271
|
-
#
|
272
|
-
# @param [
|
273
|
-
# @param [Hash]
|
274
|
-
# @
|
275
|
-
#
|
276
|
-
def self.update_versions(new_version_beta, new_version_alpha)
|
312
|
+
# Update the `version.properties` file with new `versionName` and `versionCode` values
|
313
|
+
#
|
314
|
+
# @param [String] app The name of the app to be used for beta and alpha version update
|
315
|
+
# @param [Hash] new_version_beta The version hash for the beta, containing values for keys "name" and "code"
|
316
|
+
# @param [Hash] new_version_alpha The version hash for the alpha , containing values for keys "name" and "code"
|
317
|
+
#
|
318
|
+
def self.update_versions(app, new_version_beta, new_version_alpha)
|
319
|
+
if properties_file_exists
|
320
|
+
new_version_name_beta_key = "#{app}.versionName"
|
321
|
+
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
|
+
Action.sh('./gradlew', 'updateVersionProperties', "-Pkey=#{new_version_name_beta_key}", "-Pvalue=#{new_version_beta[VERSION_NAME]}")
|
325
|
+
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
|
+
|
277
331
|
self.update_version(new_version_beta, ENV['HAS_ALPHA_VERSION'].nil? ? 'defaultConfig' : 'vanilla {')
|
278
332
|
self.update_version(new_version_alpha, 'defaultConfig') unless new_version_alpha.nil?
|
279
333
|
end
|
@@ -337,6 +391,37 @@ module Fastlane
|
|
337
391
|
return parts
|
338
392
|
end
|
339
393
|
|
394
|
+
# Ensure that a version string is correctly formatted (that is, each of its parts is a number) and returns the 2-parts version number
|
395
|
+
#
|
396
|
+
# @param [String] version The version string to verify
|
397
|
+
#
|
398
|
+
# @return [String] The "major.minor" version string, only with the first 2 components
|
399
|
+
# @raise [UserError] If any of the parts of the version string is not a number
|
400
|
+
#
|
401
|
+
def self.verify_version(version)
|
402
|
+
v_parts = get_version_parts(version)
|
403
|
+
|
404
|
+
v_parts.each do |part|
|
405
|
+
UI.user_error!('Version value can only contains numbers.') unless is_int?(part)
|
406
|
+
end
|
407
|
+
|
408
|
+
"#{v_parts[MAJOR_NUMBER]}.#{v_parts[MINOR_NUMBER]}"
|
409
|
+
end
|
410
|
+
|
411
|
+
# Check if a string is an integer.
|
412
|
+
#
|
413
|
+
# @param [String] string The string to test
|
414
|
+
#
|
415
|
+
# @return [Bool] true if the string is representing an integer value, false if not
|
416
|
+
#
|
417
|
+
def self.is_int? string
|
418
|
+
true if Integer(string) rescue false
|
419
|
+
end
|
420
|
+
|
421
|
+
#########
|
422
|
+
# Functions to support versioning through build.gradle - can be removed once all projects adopt version.properties
|
423
|
+
########
|
424
|
+
|
340
425
|
# Extract the versionName from a build.gradle file
|
341
426
|
#
|
342
427
|
# @param [String] file_path The path to the `.gradle` file
|
@@ -387,33 +472,6 @@ module Fastlane
|
|
387
472
|
return nil
|
388
473
|
end
|
389
474
|
|
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
475
|
# The path to the build.gradle file for the project.
|
418
476
|
#
|
419
477
|
# @env PROJECT_ROOT_FOLDER The path to the root of the project (the folder containing the `.git` directory).
|
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.
|
4
|
+
version: 1.3.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-06-
|
11
|
+
date: 2021-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diffy
|