watchbuild 0.3.1 → 0.4.0

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
- SHA1:
3
- metadata.gz: 74cee75f4f83e3ce767020caa298297b5c0c42fc
4
- data.tar.gz: 7a161657ffdb2213c39961866d2e07fe8399eb59
2
+ SHA256:
3
+ metadata.gz: a03ca1f40b90511ba492c3b27da024554abc0c5abf6bcdd5b67ca36051cfc74e
4
+ data.tar.gz: 7c2eef0896e8bfd34b15cc65ed7562fc05faba03b8ba77ea2464593620c1ae90
5
5
  SHA512:
6
- metadata.gz: ef9ebb4f84d61df84f886e944b79900bb355da8c5c329c1213a20b567f2e72a2eaa547e872e952e65f5ee141bb4302f21efdf3af64b501fd03936467fe695da1
7
- data.tar.gz: 259afb7d1e5728f81d79024cbb0625ac67e3150c40cb3f041bcae7db0a8739cef389e20457d2e662dc97001542bf7f6997fa447aa5bf2e17473445173b853ffa
6
+ metadata.gz: 94e2dd7cbad063ea42b536e2e406eb264d72d5f9f0d667470d0eb508f5b5f3bd7cfeb8d332be900a79a30c76fd5d5b13213409bfad0ba6a82c2a5e5b40c91cc8
7
+ data.tar.gz: a4f47cf386d5dc91da2398355b80faa6558afd0f5852a6bf6059597574a555413fb3c5dece3c29cf3e6e0a2ea1916a29c092bbcc4127e5e26b5fa2440d91aba9
data/README.md CHANGED
@@ -18,6 +18,8 @@ WatchBuild
18
18
  ###### Get a notification once your App Store Connect build is finished processing
19
19
 
20
20
  <img src=".assets/screenshot.png" width=350>
21
+ <br>
22
+ <img src=".assets/slack-screenshot.png" width=350>
21
23
 
22
24
  When you upload a new binary from Xcode to App Store Connect, you have to wait until it's done processing before you can submit it to the App Store.
23
25
 
@@ -60,6 +62,10 @@ You can pass your bundle identifier and username like this:
60
62
 
61
63
  watchbuild -a com.krausefx.app -u felix@krausefx.com
62
64
 
65
+ You can also include a Slack webhook url for notifications via Slack:
66
+
67
+ watchbuild -a com.krausefx.app -u felix@krausefx.com --slack_url https://hooks.slack.com/services/<your-webhook>
68
+
63
69
  For a list of available parameters and commands run
64
70
 
65
71
  watchbuild --help
@@ -39,7 +39,12 @@ module WatchBuild
39
39
  FastlaneCore::ConfigItem.new(key: :sample_only_once,
40
40
  description: 'Only check for the build once, instead of waiting for it to process',
41
41
  is_string: false,
42
- default_value: false)
42
+ default_value: false),
43
+ FastlaneCore::ConfigItem.new(key: :slack_url,
44
+ env_name: 'SLACK_URL',
45
+ description: 'Provide a slack webhook URL to notify a channel of a build',
46
+ is_string: true,
47
+ default_value: "")
43
48
  ]
44
49
  end
45
50
  end
@@ -15,6 +15,7 @@ module WatchBuild
15
15
 
16
16
  ENV['FASTLANE_ITC_TEAM_ID'] = WatchBuild.config[:itc_team_id] if WatchBuild.config[:itc_team_id]
17
17
  ENV['FASTLANE_ITC_TEAM_NAME'] = WatchBuild.config[:itc_team_name] if WatchBuild.config[:itc_team_name]
18
+ ENV['SLACK_URL'] = WatchBuild.config[:slack_url]
18
19
 
19
20
  Spaceship::Tunes.login(WatchBuild.config[:username], nil)
20
21
  Spaceship::Tunes.select_team
@@ -59,18 +60,19 @@ module WatchBuild
59
60
  end
60
61
 
61
62
  def notification(build, minutes)
62
- require 'terminal-notifier'
63
-
64
63
  if build.nil?
65
64
  UI.message 'Application build is still processing'
66
65
  return
67
66
  end
68
67
 
69
68
  url = "https://appstoreconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/#{@app.apple_id}/activity/ios/builds/#{build.train_version}/#{build.build_version}/details"
70
- TerminalNotifier.notify('Build finished processing',
71
- title: build.app_name,
72
- subtitle: "#{build.train_version} (#{build.build_version})",
73
- execute: "open '#{url}'")
69
+
70
+ slack_url = ENV['SLACK_URL'].to_s
71
+ if !slack_url.empty?
72
+ notify_slack(build, minutes, slack_url)
73
+ else
74
+ notify_terminal(build, minutes, url)
75
+ end
74
76
 
75
77
  UI.success('Successfully finished processing the build')
76
78
  if minutes > 0 # it's 0 minutes if there was no new build uploaded
@@ -86,6 +88,41 @@ module WatchBuild
86
88
  @app ||= Spaceship::Application.find(WatchBuild.config[:app_identifier])
87
89
  end
88
90
 
91
+ def notify_slack(build, minutes, url)
92
+ require 'net/http'
93
+ require 'uri'
94
+ require 'json'
95
+
96
+ message = "App Store build #{build.train_version} (#{build.build_version}) has finished processing in #{minutes} minutes"
97
+ slack_url = URI.parse(url)
98
+ slack_message = {
99
+ "text": message
100
+ }
101
+
102
+ header = {'Content-Type': 'application/json'}
103
+
104
+ http = Net::HTTP.new(slack_url.host, slack_url.port)
105
+ http.use_ssl = true
106
+ request = Net::HTTP::Post.new(slack_url.request_uri, header)
107
+ request.body = slack_message.to_json
108
+ response = http.request(request)
109
+
110
+ if response.kind_of?(Net::HTTPSuccess)
111
+ UI.success('Message sent to Slack.')
112
+ else
113
+ UI.user_error!('Error sending Slack notification.')
114
+ end
115
+ end
116
+
117
+ def notify_terminal(build, minutes, url)
118
+ require 'terminal-notifier'
119
+
120
+ TerminalNotifier.notify('Build finished processing',
121
+ title: build.app_name,
122
+ subtitle: "#{build.train_version} (#{build.build_version})",
123
+ execute: "open '#{url}'")
124
+ end
125
+
89
126
  def find_build
90
127
  build = nil
91
128
  app.latest_version.candidate_builds.each do |b|
@@ -1,4 +1,4 @@
1
1
  module WatchBuild
2
- VERSION = '0.3.1'.freeze
2
+ VERSION = '0.4.0'.freeze
3
3
  DESCRIPTION = 'Get a notification once your App Store Connect build is finished processing'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watchbuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-03 00:00:00.000000000 Z
11
+ date: 2020-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastlane
@@ -189,7 +189,7 @@ homepage: https://fastlane.tools
189
189
  licenses:
190
190
  - MIT
191
191
  metadata: {}
192
- post_install_message:
192
+ post_install_message:
193
193
  rdoc_options: []
194
194
  require_paths:
195
195
  - lib
@@ -204,9 +204,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
204
204
  - !ruby/object:Gem::Version
205
205
  version: '0'
206
206
  requirements: []
207
- rubyforge_project:
208
- rubygems_version: 2.6.8
209
- signing_key:
207
+ rubyforge_project:
208
+ rubygems_version: 2.7.6.2
209
+ signing_key:
210
210
  specification_version: 4
211
211
  summary: Get a notification once your App Store Connect build is finished processing
212
212
  test_files: []