fastlane-plugin-apadmi_grout 1.1.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e09c118b4ee869170d2846d836cf0f7e1193619e41bbd92771fc187f0e1c5eb2
4
- data.tar.gz: d0f1ae6d8c4210f74795363f9662e94cf14fe101835aeed85c527c3723f5640b
3
+ metadata.gz: 9af9f8491b34ea80682d1c898ecc0bfc9a8fa32b15720b23c1889d419fc094ce
4
+ data.tar.gz: 68e64c22fa7ca8242c3692c56f5d2f63d104b4e7ce66cfb13f17f713c17712cb
5
5
  SHA512:
6
- metadata.gz: c52883e0ff3547408b61893df958bb7f152c59a4c609e8af5ce0828290b3d662140e3b3ed8342c4475002d111a6a06976de60cf673986341c24d52aa38b05a98
7
- data.tar.gz: db570ea6fb066f893248bea522a932d03e1792a1d817635e1c910ebf6b8c06b21aa4fb9648b4328f3d1e57235351a63497046cb1a56ede6a946e7b21a434c3f8
6
+ metadata.gz: 7916a6834d7b5938c3049ceb308ec7fd9ef1e8c45eb6f3c58b1ab57f3ef758cb7b4fadf2458ae13f87c60a23a333483389438a3bd6ef23e96c26213e9df73801
7
+ data.tar.gz: 77d379855694066f7e4f3616facec6484152e298ee73c2a59eba5c79d5704f9f1729fc3ac88692eedaa3de4cf7e668158f1f7af08bc1d42bf49e091ab67212ce
data/CHANGELOG.md CHANGED
@@ -1,9 +1,17 @@
1
1
  # Fastlane Plugin Changelog
2
2
 
3
+ ## [2.1.0] - 22-07-26
4
+ * Bump core library version dependency
5
+
6
+ ## [2.0.0] - 2022-05-25
7
+ * Implement ADO support for all relevant existing actions
8
+
9
+ ## [1.2.0] - 2022-05-17
10
+ * Automatically save generated release notes to a file on disk.
11
+
3
12
  ## [1.1.0] - 2022-05-12
4
13
  * Support allowing tickets that aren't assigned to a sprint to be moved.
5
14
  * Create action for obtaining iOS deployment target
6
15
 
7
16
  ## [1.0.0] - 2022-05-09 - Initial release
8
-
9
17
  * Fastlane wrappers for new core functionality
@@ -12,18 +12,11 @@ module Fastlane
12
12
  logger = FastLane::FastlaneLogger.new
13
13
  logger.message("Finding tickets to move")
14
14
 
15
- build_tools = Apadmi::Grout::DependencyInjector.new(
16
- params[:jira_username],
17
- params[:jira_api_token],
18
- params[:jira_base_url],
19
- params[:jira_context_path],
20
- params[:jira_project_key],
21
- logger
22
- )
15
+ build_tools = Apadmi::Grout::DIWrapper.di(params, logger)
23
16
 
24
17
  build_tools.find_tickets_to_move_action.run(
25
- params[:jira_component_name],
26
- params[:jira_status_from],
18
+ params[:board_component_name],
19
+ params[:board_status_from],
27
20
  [],
28
21
  params[:custom_flag_messages],
29
22
  params[:options]
@@ -39,62 +32,21 @@ module Fastlane
39
32
  end
40
33
 
41
34
  def self.available_options
42
- [
43
- ########## JIRA Auth ##########
44
- FastlaneCore::ConfigItem.new(key: :jira_username,
45
- description: "JIRA username for authentication with JIRA",
46
- env_name: "JIRA_USERNAME",
47
- type: String,
48
- verify_block: proc do |value|
49
- UI.user_error!("Didn't pass a valid JIRA username") unless value
50
- end,
51
- optional: false),
52
- FastlaneCore::ConfigItem.new(key: :jira_api_token,
53
- description: "JIRA api token for authentication with JIRA",
54
- env_name: "JIRA_API_TOKEN",
55
- type: String,
56
- verify_block: proc do |value|
57
- UI.user_error!("Didn't pass a valid JIRA api token") unless value
58
- end,
59
- optional: false),
60
- FastlaneCore::ConfigItem.new(key: :jira_project_key,
61
- description: "JIRA project key",
62
- env_name: "JIRA_PROJECT_KEY",
63
- type: String,
64
- verify_block: proc do |value|
65
- UI.user_error!("Didn't pass a valid JIRA project key, e.g PPT") unless value
66
- end,
67
- optional: false),
68
- FastlaneCore::ConfigItem.new(key: :jira_base_url,
69
- description: "JIRA base url for the organisation",
70
- env_name: "JIRA_BASE_URL",
71
- type: String,
72
- verify_block: proc do |value|
73
- UI.user_error!("Didn't pass a valid JIRA base url") unless value
74
- end,
75
- optional: false),
76
- FastlaneCore::ConfigItem.new(key: :jira_context_path,
77
- description: "JIRA context path whatever that is ¯\\_(ツ)_/¯",
78
- env_name: "JIRA_CONTEXT_PATH",
79
- default_value: "",
80
- type: String,
81
- optional: true),
82
-
83
- ########## Action Specific ##########
84
- FastlaneCore::ConfigItem.new(key: :jira_component_name,
85
- description: "The JIRA component by which to filter tickets",
86
- env_name: "JIRA_COMPONENT_NAME",
35
+ Apadmi::Grout::CommonOptions.board_options + [
36
+ FastlaneCore::ConfigItem.new(key: :board_component_name,
37
+ description: "The component by which to filter tickets",
38
+ env_name: "BOARD_COMPONENT_NAME",
87
39
  type: String,
88
40
  verify_block: proc do |value|
89
- UI.user_error!("Didn't pass a valid JIRA component") unless value
41
+ UI.user_error!("Didn't pass a valid component") unless value
90
42
  end,
91
43
  optional: false),
92
- FastlaneCore::ConfigItem.new(key: :jira_status_from,
93
- description: "The JIRA status to filter by to find tickets",
94
- env_name: "JIRA_STATUS_FROM",
44
+ FastlaneCore::ConfigItem.new(key: :board_status_from,
45
+ description: "The status to filter by to find tickets",
46
+ env_name: "BOARD_STATUS_FROM",
95
47
  type: String,
96
48
  verify_block: proc do |value|
97
- UI.user_error!("Didn't pass a valid JIRA status") unless value
49
+ UI.user_error!("Didn't pass a valid status") unless value
98
50
  end,
99
51
  optional: false),
100
52
  FastlaneCore::ConfigItem.new(key: :custom_flag_messages,
@@ -3,6 +3,7 @@
3
3
  require "fastlane/action"
4
4
  require "apadmi_grout"
5
5
  require_relative "../utils/fastlane_logger"
6
+ require "fileutils"
6
7
 
7
8
  module Fastlane
8
9
  module Actions
@@ -12,14 +13,7 @@ module Fastlane
12
13
  logger = FastLane::FastlaneLogger.new
13
14
  logger.message("Generating Release Notes")
14
15
 
15
- build_tools = Apadmi::Grout::DependencyInjector.new(
16
- params[:jira_username],
17
- params[:jira_api_token],
18
- params[:jira_base_url],
19
- params[:jira_context_path],
20
- params[:jira_project_key],
21
- logger
22
- )
16
+ build_tools = Apadmi::Grout::DIWrapper.di(params, logger)
23
17
 
24
18
  logger.message("Finding changelog between #{params[:oldest_ref]} and #{params[:latest_ref]}")
25
19
  changelog = Fastlane::Actions::ChangelogFromGitCommitsAction.run(
@@ -43,7 +37,14 @@ module Fastlane
43
37
  )
44
38
 
45
39
  logger.message("Generating Release Notes")
46
- build_tools.generate_release_notes_action.run(config)
40
+ release_notes = build_tools.generate_release_notes_action.run(config)
41
+
42
+ FileUtils.mkdir_p(params[:output_dir])
43
+ file_name = "#{params[:output_dir]}/#{params[:release_notes_title]}-#{params[:app_version]}.md"
44
+
45
+ File.write(file_name, release_notes)
46
+ logger.success("Saved Release Notes to #{file_name}")
47
+ [release_notes, file_name]
47
48
  end
48
49
 
49
50
  def self.description
@@ -55,54 +56,13 @@ module Fastlane
55
56
  end
56
57
 
57
58
  def self.return_value
58
- "The full release notes generated as one String"
59
+ "Array of two items: [release_notes_as_string, path_to_file_on_disk]"
59
60
  end
60
61
 
61
62
  def self.available_options
62
- [
63
- ########## JIRA Auth ##########
64
- FastlaneCore::ConfigItem.new(key: :jira_username,
65
- description: "JIRA username for authentication with JIRA",
66
- env_name: "JIRA_USERNAME",
67
- type: String,
68
- verify_block: proc do |value|
69
- UI.user_error!("Didn't pass a valid JIRA username") unless value
70
- end,
71
- optional: false),
72
- FastlaneCore::ConfigItem.new(key: :jira_api_token,
73
- description: "JIRA api token for authentication with JIRA",
74
- env_name: "JIRA_API_TOKEN",
75
- type: String,
76
- verify_block: proc do |value|
77
- UI.user_error!("Didn't pass a valid JIRA api token") unless value
78
- end,
79
- optional: false),
80
- FastlaneCore::ConfigItem.new(key: :jira_project_key,
81
- description: "JIRA project key",
82
- env_name: "JIRA_PROJECT_KEY",
83
- type: String,
84
- verify_block: proc do |value|
85
- UI.user_error!("Didn't pass a valid JIRA project key, e.g PPT") unless value
86
- end,
87
- optional: false),
88
- FastlaneCore::ConfigItem.new(key: :jira_base_url,
89
- description: "JIRA base url for the organisation",
90
- env_name: "JIRA_BASE_URL",
91
- type: String,
92
- verify_block: proc do |value|
93
- UI.user_error!("Didn't pass a valid JIRA base url") unless value
94
- end,
95
- optional: false),
96
- FastlaneCore::ConfigItem.new(key: :jira_context_path,
97
- description: "JIRA context path whatever that is ¯\\_(ツ)_/¯",
98
- env_name: "JIRA_CONTEXT_PATH",
99
- default_value: "",
100
- type: String,
101
- optional: true),
102
-
103
- ########## Action Specific ##########
63
+ Apadmi::Grout::CommonOptions.board_options + [
104
64
  FastlaneCore::ConfigItem.new(key: :tickets_moved_by_build,
105
- description: "Any JIRA tickets who's state was moved by this build",
65
+ description: "Any tickets who's state was moved by this build",
106
66
  default_value: [],
107
67
  type: Array,
108
68
  optional: true),
@@ -163,7 +123,11 @@ module Fastlane
163
123
  FastlaneCore::ConfigItem.new(key: :templates,
164
124
  description: "Release notes templates",
165
125
  default_value: Apadmi::Grout::Templates.default,
166
- type: Apadmi::Grout::Templates)
126
+ type: Apadmi::Grout::Templates),
127
+ FastlaneCore::ConfigItem.new(key: :output_dir,
128
+ description: "Directory in which to save the release notes file",
129
+ default_value: ENV["BITRISE_DEPLOY_DIR"] || "#{Apadmi::Grout::GitUtils.git_root}/build",
130
+ type: String)
167
131
  ]
168
132
  end
169
133
 
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "fastlane/action"
4
+ require "apadmi_grout"
5
+ require_relative "../utils/fastlane_logger"
6
+
7
+ module Fastlane
8
+ module Actions
9
+ # Move JIRA tickets and generate release notes
10
+ class MoveTicketsAction < Action
11
+ def self.run(params)
12
+ logger = FastLane::FastlaneLogger.new
13
+ logger.message("Moving #{params[:board_provider]} tickets")
14
+
15
+ build_tools = Apadmi::Grout::DIWrapper.di(params, logger)
16
+
17
+ build_tools.move_tickets_action.run(
18
+ params[:versions],
19
+ params[:issues],
20
+ params[:board_status_to]
21
+ )
22
+ end
23
+
24
+ def self.description
25
+ "Convenience lane that moves all supplied jira tickets to new status and assigns versions."
26
+ end
27
+
28
+ def self.authors
29
+ ["samdc@apadmi.com"]
30
+ end
31
+
32
+ def self.available_options
33
+ Apadmi::Grout::CommonOptions.board_options + [
34
+ FastlaneCore::ConfigItem.new(key: :board_status_to,
35
+ description: "The JIRA status to move the tickets to",
36
+ env_name: "BOARD_STATUS_TO",
37
+ type: String,
38
+ verify_block: proc do |value|
39
+ UI.user_error!("Didn't pass a valid JIRA status") unless value
40
+ end,
41
+ optional: false),
42
+ FastlaneCore::ConfigItem.new(key: :versions,
43
+ description: "The versions to add to the jira ticket",
44
+ type: Array,
45
+ verify_block: proc do |value|
46
+ UI.user_error!("Didn't pass a valid array of versions") unless value || value.empty
47
+ end,
48
+ optional: false),
49
+ FastlaneCore::ConfigItem.new(key: :issues,
50
+ description: "The issues to be moved",
51
+ type: Array,
52
+ verify_block: proc do |value|
53
+ UI.user_error!("Didn't pass a valid array of issues") unless value
54
+ end,
55
+ optional: false)
56
+ ]
57
+ end
58
+
59
+ def self.is_supported?(_platform)
60
+ true
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Apadmi
4
+ module Grout
5
+ # Common options used to setup ADO and JIRA integration
6
+ class CommonOptions
7
+ def self.board_options
8
+ [
9
+ FastlaneCore::ConfigItem.new(key: :board_base_url,
10
+ description: "Base url for the organisation",
11
+ env_name: "BOARD_BASE_URL",
12
+ type: String,
13
+ verify_block: proc do |value|
14
+ UI.user_error!("Didn't pass a valid base url") unless value
15
+ end,
16
+ optional: false),
17
+ FastlaneCore::ConfigItem.new(key: :board_provider,
18
+ description: "The board provider, valid values: ADO|JIRA",
19
+ env_name: "BOARD_PROVIDER",
20
+ type: String,
21
+ default_value: "JIRA",
22
+ verify_block: proc do |value|
23
+ UI.user_error!("Didn't pass a valid board provider") unless value
24
+ end,
25
+ optional: false)
26
+ ] + ado_options + jira_options
27
+ end
28
+
29
+ def self.ado_options
30
+ [
31
+ FastlaneCore::ConfigItem.new(key: :ado_pat,
32
+ description: "ADO personal access token for authentication",
33
+ env_name: "ADO_PAT",
34
+ type: String,
35
+ verify_block: proc do |value|
36
+ UI.user_error!("Didn't pass a valid personal access token") unless value
37
+ end,
38
+ optional: true)
39
+ ]
40
+ end
41
+
42
+ def self.jira_options
43
+ [
44
+ FastlaneCore::ConfigItem.new(key: :jira_username,
45
+ description: "JIRA username for authentication with JIRA",
46
+ env_name: "JIRA_USERNAME",
47
+ type: String,
48
+ optional: true),
49
+ FastlaneCore::ConfigItem.new(key: :jira_api_token,
50
+ description: "JIRA api token for authentication with JIRA",
51
+ env_name: "JIRA_API_TOKEN",
52
+ type: String,
53
+ optional: true),
54
+ FastlaneCore::ConfigItem.new(key: :jira_project_key,
55
+ description: "JIRA project key",
56
+ env_name: "JIRA_PROJECT_KEY",
57
+ type: String,
58
+ optional: true),
59
+
60
+ FastlaneCore::ConfigItem.new(key: :jira_context_path,
61
+ description: "JIRA context path whatever that is ¯\\_(ツ)_/¯",
62
+ env_name: "JIRA_CONTEXT_PATH",
63
+ default_value: "",
64
+ type: String,
65
+ optional: true)
66
+ ]
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Apadmi
4
+ module Grout
5
+ # Helper function for constructing the DI from params
6
+ class DIWrapper
7
+ def self.di(params, logger)
8
+ case params[:board_provider]
9
+ when "ADO"
10
+ raise "Invalid ADO personal access token" if params[:ado_pat].blank?
11
+
12
+ Apadmi::Grout::DependencyInjector.init_for_ado(
13
+ params[:ado_pat],
14
+ params[:board_base_url],
15
+ logger
16
+ )
17
+ when "JIRA"
18
+ raise "Invalid jira username" if params[:jira_username].blank?
19
+ raise "Invalid jira_api_token" if params[:jira_api_token].blank?
20
+ raise "Invalid jira_project_key" if params[:jira_project_key].blank?
21
+
22
+ Apadmi::Grout::DependencyInjector.init_for_jira(
23
+ params[:jira_username],
24
+ params[:jira_api_token],
25
+ params[:board_base_url],
26
+ params[:jira_context_path],
27
+ params[:jira_project_key],
28
+ logger
29
+ )
30
+ else
31
+ raise "Unsupported board provider: #{params[:board_provider]}"
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Fastlane
4
4
  module ApadmiGrout
5
- VERSION = "1.1.0"
5
+ VERSION = "2.1.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-apadmi_grout
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
- - Sam
7
+ - Apadmi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-12 00:00:00.000000000 Z
11
+ date: 2022-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apadmi_grout
@@ -164,7 +164,9 @@ files:
164
164
  - lib/fastlane/plugin/apadmi_grout/actions/find_tickets_to_move_action.rb
165
165
  - lib/fastlane/plugin/apadmi_grout/actions/generate_release_notes_action.rb
166
166
  - lib/fastlane/plugin/apadmi_grout/actions/get_deployment_target_action.rb
167
- - lib/fastlane/plugin/apadmi_grout/actions/move_jira_tickets_action.rb
167
+ - lib/fastlane/plugin/apadmi_grout/actions/move_tickets_action.rb
168
+ - lib/fastlane/plugin/apadmi_grout/utils/common_options.rb
169
+ - lib/fastlane/plugin/apadmi_grout/utils/di_wrapper.rb
168
170
  - lib/fastlane/plugin/apadmi_grout/utils/fastlane_logger.rb
169
171
  - lib/fastlane/plugin/apadmi_grout/version.rb
170
172
  homepage: https://bitbucket.org/apadmi/apadmi-grout-ruby/
@@ -1,112 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "fastlane/action"
4
- require "apadmi_grout"
5
- require_relative "../utils/fastlane_logger"
6
-
7
- module Fastlane
8
- module Actions
9
- # Move JIRA tickets and generate release notes
10
- class MoveJiraTicketsAction < Action
11
- def self.run(params)
12
- logger = FastLane::FastlaneLogger.new
13
- logger.message("Moving Jira tickets")
14
-
15
- build_tools = Apadmi::Grout::DependencyInjector.new(
16
- params[:jira_username],
17
- params[:jira_api_token],
18
- params[:jira_base_url],
19
- params[:jira_context_path],
20
- params[:jira_project_key],
21
- logger
22
- )
23
-
24
- build_tools.move_jira_tickets_action.run(
25
- params[:versions],
26
- params[:issues],
27
- params[:jira_status_to]
28
- )
29
- end
30
-
31
- def self.description
32
- "Convenience lane that moves all supplied jira tickets to new status and assigns versions."
33
- end
34
-
35
- def self.authors
36
- ["samdc@apadmi.com"]
37
- end
38
-
39
- def self.available_options
40
- [
41
- ########## JIRA Auth ##########
42
- FastlaneCore::ConfigItem.new(key: :jira_username,
43
- description: "JIRA username for authentication with JIRA",
44
- env_name: "JIRA_USERNAME",
45
- type: String,
46
- verify_block: proc do |value|
47
- UI.user_error!("Didn't pass a valid JIRA username") unless value
48
- end,
49
- optional: false),
50
- FastlaneCore::ConfigItem.new(key: :jira_api_token,
51
- description: "JIRA api token for authentication with JIRA",
52
- env_name: "JIRA_API_TOKEN",
53
- type: String,
54
- verify_block: proc do |value|
55
- UI.user_error!("Didn't pass a valid JIRA api token") unless value
56
- end,
57
- optional: false),
58
- FastlaneCore::ConfigItem.new(key: :jira_project_key,
59
- description: "JIRA project key",
60
- env_name: "JIRA_PROJECT_KEY",
61
- type: String,
62
- verify_block: proc do |value|
63
- UI.user_error!("Didn't pass a valid JIRA project key, e.g PPT") unless value
64
- end,
65
- optional: false),
66
- FastlaneCore::ConfigItem.new(key: :jira_base_url,
67
- description: "JIRA base url for the organisation",
68
- env_name: "JIRA_BASE_URL",
69
- type: String,
70
- verify_block: proc do |value|
71
- UI.user_error!("Didn't pass a valid JIRA base url") unless value
72
- end,
73
- optional: false),
74
- FastlaneCore::ConfigItem.new(key: :jira_context_path,
75
- description: "JIRA context path whatever that is ¯\\_(ツ)_/¯",
76
- env_name: "JIRA_CONTEXT_PATH",
77
- default_value: "",
78
- type: String,
79
- optional: true),
80
-
81
- ########## Action Specific ##########
82
- FastlaneCore::ConfigItem.new(key: :jira_status_to,
83
- description: "The JIRA status to move the tickets to",
84
- env_name: "JIRA_STATUS_TO",
85
- type: String,
86
- verify_block: proc do |value|
87
- UI.user_error!("Didn't pass a valid JIRA status") unless value
88
- end,
89
- optional: false),
90
- FastlaneCore::ConfigItem.new(key: :versions,
91
- description: "The versions to add to the jira ticket",
92
- type: Array,
93
- verify_block: proc do |value|
94
- UI.user_error!("Didn't pass a valid array of versions") unless value || value.empty
95
- end,
96
- optional: false),
97
- FastlaneCore::ConfigItem.new(key: :issues,
98
- description: "The issues to be moved",
99
- type: Array,
100
- verify_block: proc do |value|
101
- UI.user_error!("Didn't pass a valid array of issues") unless value
102
- end,
103
- optional: false)
104
- ]
105
- end
106
-
107
- def self.is_supported?(_platform)
108
- true
109
- end
110
- end
111
- end
112
- end