fastlane-plugin-stream_actions 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f544bf6c83e2ee40065898727ea89248813a39d762226da369fed2f2bbc2c17
4
- data.tar.gz: 2d0af5023635377fbd00563aab6e2a775afcbcb75d8ceae4ceea2c91574b0065
3
+ metadata.gz: 24de8c23f06a9cbda0b9eef312b28303c1e6ef6b0d1cb5b72cdf5eaaee03b582
4
+ data.tar.gz: ba45fc47a3248fb3b780826e3d2200c3dd24ec8b89ebd4978acffc35dd0e56cf
5
5
  SHA512:
6
- metadata.gz: 7c828c0531e835db91bcc70e244564422d94919e3447a14cf9f04cca1512be6b28ce920b9d07c1a36f18bbdce89818e63ea5fb7a21067805e748efc88764b428
7
- data.tar.gz: 8eb6b7a75fcae621754a4caa7b3f84a4b823ac159b3e3ebf1381372e81760cbf8f47a79b1e625eacae998add77535930a72b3aa0a4c784d36be9928139c7ca8f
6
+ metadata.gz: af79d87f7796eb3ba55fb9f9451885dfbd6fd0b3dab27bd96fa4542b10a27dcedf69e032e13fdc26a1b6ae4b37d550f6ebc953c6e845e2fcc93825ec2467cfe3
7
+ data.tar.gz: f3884039a480f3516b0fd443726d0f5780bfdc4a8d221429d4290f7fde5f617994e2d25cb4d564c9933102f8408c9b90b932d75a2b1d0f0adea6e3ac2ef1270c
data/README.md CHANGED
@@ -10,10 +10,7 @@ gem 'fastlane-plugin-stream_actions'
10
10
 
11
11
  ## About stream_actions
12
12
 
13
- | Action | Description | Supported Platforms |
14
- | ------ | ----------- | ------------------- |
15
- | [retrieve_xctest_names](docs/actions/retrieve_xctest_names.md)| Retrieves test names from xctestrun file | ios |
16
- | [touch_changelog](docs/actions/touch_changelog.md)| Updates `CHANGELOG.md` file with release | |
13
+ Stream Actions are used to share the codebase and automate the release process for Stream SDKs.
17
14
 
18
15
  ## Start working on this plugin
19
16
 
@@ -0,0 +1,54 @@
1
+ module Fastlane
2
+ module Actions
3
+ require 'fastlane/actions/xcodebuild'
4
+
5
+ class IsCheckRequiredAction < Action
6
+ def self.run(params)
7
+ return true if ENV['GITHUB_EVENT_NAME'] != 'pull_request'
8
+
9
+ pr_number = JSON.parse(ENV['GITHUB_EVENT'])['pull_request']['number']
10
+
11
+ changed_files = sh("gh pr view #{pr_number} --json files -q '.files[].path'").split("\n")
12
+
13
+ return true if changed_files.size == 100 # TODO: https://github.com/cli/cli/issues/5368
14
+
15
+ changed_files.select! do |path|
16
+ params[:sources][params[:type].to_sym].any? { |required| path.start_with?(required) }
17
+ end
18
+
19
+ changed_files.size.positive?
20
+ end
21
+
22
+ #####################################################
23
+ # @!group Documentation
24
+ #####################################################
25
+
26
+ def self.description
27
+ 'Analyzes the impact of changes on PR'
28
+ end
29
+
30
+ def self.available_options
31
+ [
32
+ FastlaneCore::ConfigItem.new(
33
+ key: :sources,
34
+ description: 'Array of paths to scan',
35
+ verify_block: proc do |source|
36
+ UI.user_error!("Sources have to be specified") unless source
37
+ end
38
+ ),
39
+ FastlaneCore::ConfigItem.new(
40
+ key: :type,
41
+ description: 'Type of the check that was triggered',
42
+ verify_block: proc do |type|
43
+ UI.user_error!("Type has to be specified") unless type
44
+ end
45
+ )
46
+ ]
47
+ end
48
+
49
+ def self.supported?(_platform)
50
+ true
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,50 @@
1
+ module Fastlane
2
+ module Actions
3
+ require 'fastlane/actions/xcodebuild'
4
+
5
+ class PodPushSafelyAction < Action
6
+ def self.run(params)
7
+ pod_push_safely(params)
8
+ end
9
+
10
+ def self.pod_push_safely(params)
11
+ UI.message("Starting to push podspec: #{params[:podspec]}")
12
+ Fastlane::Actions::PodPushAction.run(path: params[:podspec], allow_warnings: true, synchronous: params[:sync])
13
+ rescue StandardError => e
14
+ UI.message(e)
15
+ UI.message("pod_push failed for #{params[:podspec]}. Waiting a minute until retry for trunk to get updated...")
16
+ sleep(60) # sleep for a minute, wait until trunk gets updates
17
+ pod_push_safely(params)
18
+ end
19
+
20
+ #####################################################
21
+ # @!group Documentation
22
+ #####################################################
23
+
24
+ def self.description
25
+ 'Releases pod to cocoapods trunk'
26
+ end
27
+
28
+ def self.available_options
29
+ [
30
+ FastlaneCore::ConfigItem.new(
31
+ key: :podspec,
32
+ description: 'Podspec path',
33
+ verify_block: proc do |pod|
34
+ UI.user_error!("Podspec path has to be specified") unless pod
35
+ end
36
+ ),
37
+ FastlaneCore::ConfigItem.new(
38
+ key: :sync,
39
+ description: 'When `sync` is false, pod trunk push is run asynchronously',
40
+ is_string: false
41
+ )
42
+ ]
43
+ end
44
+
45
+ def self.supported?(_platform)
46
+ [:ios].include?(platform)
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,52 @@
1
+ module Fastlane
2
+ module Actions
3
+ class ReadChangelogAction < Action
4
+ def self.run(params)
5
+ UI.user_error!('You need to pass the version of the release you want to obtain the changelog from') unless options[:version]
6
+
7
+ UI.message("Getting changelog for #{options[:version]}")
8
+ reading_changelog = false
9
+ changes = ''
10
+ changelog_lines = File.readlines('../CHANGELOG.md')
11
+ changelog_lines.each do |line|
12
+ start_token = '# ['
13
+ if reading_changelog
14
+ break if line.start_with?(start_token)
15
+
16
+ changes << line
17
+ end
18
+
19
+ reading_changelog = true if line.start_with?("#{start_token}#{options[:version]}")
20
+ end
21
+
22
+ UI.user_error!("No changelog found for #{options[:version]}") unless changes.length > 0
23
+ UI.success("Changelog for #{options[:version]}: \n#{changes}")
24
+ changes
25
+ end
26
+
27
+ #####################################################
28
+ # @!group Documentation
29
+ #####################################################
30
+
31
+ def self.description
32
+ 'Gets updates from the CHANGELOG.md'
33
+ end
34
+
35
+ def self.available_options
36
+ [
37
+ FastlaneCore::ConfigItem.new(
38
+ key: :version,
39
+ description: 'Release version',
40
+ verify_block: proc do |v|
41
+ UI.user_error!("You need to pass the version of the release you want to obtain the changelog from") unless v
42
+ end
43
+ )
44
+ ]
45
+ end
46
+
47
+ def self.supported?(_platform)
48
+ [:ios].include?(platform)
49
+ end
50
+ end
51
+ end
52
+ end
@@ -110,10 +110,6 @@ module Fastlane
110
110
  ]
111
111
  end
112
112
 
113
- def self.authors
114
- ['alteral']
115
- end
116
-
117
113
  def self.supported?(_platform)
118
114
  [:ios].include?(platform)
119
115
  end
@@ -73,10 +73,6 @@ module Fastlane
73
73
  ]
74
74
  end
75
75
 
76
- def self.authors
77
- ['b-onc']
78
- end
79
-
80
76
  def self.is_supported?(platform)
81
77
  true
82
78
  end
@@ -0,0 +1,49 @@
1
+ module Fastlane
2
+ module Actions
3
+ class UpdateTestplanAction < Action
4
+ def self.run(params)
5
+ data_hash = JSON.parse(File.read(params[:path]))
6
+
7
+ # Create the `environmentVariableEntries` array if it doesn't exist
8
+ data_hash['defaultOptions']['environmentVariableEntries'] ||= []
9
+
10
+ data_hash['defaultOptions']['environmentVariableEntries'] << params[:env_vars]
11
+ File.write(test_plan_file, JSON.pretty_generate(data_hash))
12
+
13
+ UI.success("✅ `#{params[:env_vars]}` ENV variables have been added to #{params[:path]}")
14
+ UI.message("👀 #{params[:path]} ENV variables:\n#{data_hash['defaultOptions']['environmentVariableEntries']}")
15
+ end
16
+
17
+ #####################################################
18
+ # @!group Documentation
19
+ #####################################################
20
+
21
+ def self.description
22
+ 'Retrieves test names from xctestrun file'
23
+ end
24
+
25
+ def self.available_options
26
+ [
27
+ FastlaneCore::ConfigItem.new(
28
+ key: :path,
29
+ description: 'The test plan file path',
30
+ verify_block: proc do |path|
31
+ UI.user_error!("Cannot find the testplan file '#{path}'") unless File.exist?(path)
32
+ end
33
+ ),
34
+ FastlaneCore::ConfigItem.new(
35
+ key: :env_vars,
36
+ description: 'The environment variables to add to test plan',
37
+ verify_block: proc do |path|
38
+ UI.user_error!("The environment variables array should not be empty") if env_vars.empty?
39
+ end
40
+ )
41
+ ]
42
+ end
43
+
44
+ def self.supported?(_platform)
45
+ [:ios].include?(platform)
46
+ end
47
+ end
48
+ end
49
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module StreamActions
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-stream_actions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GetStream
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-27 00:00:00.000000000 Z
11
+ date: 2022-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -228,8 +228,12 @@ extra_rdoc_files: []
228
228
  files:
229
229
  - README.md
230
230
  - lib/fastlane/plugin/stream_actions.rb
231
+ - lib/fastlane/plugin/stream_actions/actions/is_check_required.rb
232
+ - lib/fastlane/plugin/stream_actions/actions/pod_push_safely.rb
233
+ - lib/fastlane/plugin/stream_actions/actions/read_changelog.rb
231
234
  - lib/fastlane/plugin/stream_actions/actions/retrieve_xctest_names.rb
232
235
  - lib/fastlane/plugin/stream_actions/actions/touch_changelog.rb
236
+ - lib/fastlane/plugin/stream_actions/actions/update_testplan.rb
233
237
  - lib/fastlane/plugin/stream_actions/version.rb
234
238
  homepage: https://github.com/GetStream/fastlane-plugin-stream_actions
235
239
  licenses: []