watchbuild 0.4.0 → 0.5.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: a03ca1f40b90511ba492c3b27da024554abc0c5abf6bcdd5b67ca36051cfc74e
4
- data.tar.gz: 7c2eef0896e8bfd34b15cc65ed7562fc05faba03b8ba77ea2464593620c1ae90
3
+ metadata.gz: 2843da115ef36c055fbca3c1fbc6b4f431d4c666c84d64d4be63a00fa3f69fc6
4
+ data.tar.gz: 9e2bf7875dcd8b2be76376c54ef5e10945c57b52202e5144b71ffba45816acab
5
5
  SHA512:
6
- metadata.gz: 94e2dd7cbad063ea42b536e2e406eb264d72d5f9f0d667470d0eb508f5b5f3bd7cfeb8d332be900a79a30c76fd5d5b13213409bfad0ba6a82c2a5e5b40c91cc8
7
- data.tar.gz: a4f47cf386d5dc91da2398355b80faa6558afd0f5852a6bf6059597574a555413fb3c5dece3c29cf3e6e0a2ea1916a29c092bbcc4127e5e26b5fa2440d91aba9
6
+ metadata.gz: d2f042e9f7c70d84ce65c83908e70e7ddb8e77659e534fd84d93cbbbd65c6381ef649d962b168a8f9580996ab308a6347ce00df45e25cb81f03beddc51daadf4
7
+ data.tar.gz: 4957b2130a16625dc8480e6b590f74d5b9b8e6a87d42b02b054fca46fbf80a4d7a2724cee90aaced684d3e67bf82dbe4eaf9ca79987f7d1eb53713b8453f20b2
@@ -17,8 +17,7 @@ module WatchBuild
17
17
  ENV['FASTLANE_ITC_TEAM_NAME'] = WatchBuild.config[:itc_team_name] if WatchBuild.config[:itc_team_name]
18
18
  ENV['SLACK_URL'] = WatchBuild.config[:slack_url]
19
19
 
20
- Spaceship::Tunes.login(WatchBuild.config[:username], nil)
21
- Spaceship::Tunes.select_team
20
+ Spaceship::ConnectAPI.login(WatchBuild.config[:username], nil, use_portal: false, use_tunes: true)
22
21
  UI.message('Successfully logged in')
23
22
 
24
23
  start = Time.now
@@ -30,22 +29,31 @@ module WatchBuild
30
29
  def wait_for_build(start_time)
31
30
  UI.user_error!("Could not find app with app identifier #{WatchBuild.config[:app_identifier]}") unless app
32
31
 
32
+ build = nil
33
+ showed_info = false
34
+
33
35
  loop do
34
36
  begin
35
- build = find_build
36
- return build if build.processing == false
37
-
38
- seconds_elapsed = (Time.now - start_time).to_i.abs
39
- case seconds_elapsed
40
- when 0..59
41
- time_elapsed = Time.at(seconds_elapsed).utc.strftime '%S seconds'
42
- when 60..3599
43
- time_elapsed = Time.at(seconds_elapsed).utc.strftime '%M:%S minutes'
37
+ build = find_build(build)
38
+
39
+ if build.nil?
40
+ UI.important("Read more information on why this build isn't showing up yet - https://github.com/fastlane/fastlane/issues/14997") unless showed_info
41
+ showed_info = true
44
42
  else
45
- time_elapsed = Time.at(seconds_elapsed).utc.strftime '%H:%M:%S hours'
43
+ return build if build.processed?
44
+
45
+ seconds_elapsed = (Time.now - start_time).to_i.abs
46
+ case seconds_elapsed
47
+ when 0..59
48
+ time_elapsed = Time.at(seconds_elapsed).utc.strftime '%S seconds'
49
+ when 60..3599
50
+ time_elapsed = Time.at(seconds_elapsed).utc.strftime '%M:%S minutes'
51
+ else
52
+ time_elapsed = Time.at(seconds_elapsed).utc.strftime '%H:%M:%S hours'
53
+ end
54
+
55
+ UI.message("Waiting #{time_elapsed} for App Store Connect to process the build #{build.app_version} (#{build.version})... this might take a while...")
46
56
  end
47
-
48
- UI.message("Waiting #{time_elapsed} for App Store Connect to process the build #{build.train_version} (#{build.build_version})... this might take a while...")
49
57
  rescue => ex
50
58
  UI.error(ex)
51
59
  UI.message('Something failed... trying again to recover')
@@ -65,7 +73,9 @@ module WatchBuild
65
73
  return
66
74
  end
67
75
 
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"
76
+ platform = build.pre_release_version.platform.downcase.gsub('_', '')
77
+
78
+ url = "https://appstoreconnect.apple.com/apps/#{app.id}/testflight/#{platform}/#{build.id}/metadata"
69
79
 
70
80
  slack_url = ENV['SLACK_URL'].to_s
71
81
  if !slack_url.empty?
@@ -85,7 +95,7 @@ module WatchBuild
85
95
  private
86
96
 
87
97
  def app
88
- @app ||= Spaceship::Application.find(WatchBuild.config[:app_identifier])
98
+ @app ||= Spaceship::ConnectAPI::App.find(WatchBuild.config[:app_identifier])
89
99
  end
90
100
 
91
101
  def notify_slack(build, minutes, url)
@@ -93,7 +103,7 @@ module WatchBuild
93
103
  require 'uri'
94
104
  require 'json'
95
105
 
96
- message = "App Store build #{build.train_version} (#{build.build_version}) has finished processing in #{minutes} minutes"
106
+ message = "App Store build #{build.app_version} (#{build.version}) has finished processing in #{minutes} minutes"
97
107
  slack_url = URI.parse(url)
98
108
  slack_message = {
99
109
  "text": message
@@ -118,19 +128,24 @@ module WatchBuild
118
128
  require 'terminal-notifier'
119
129
 
120
130
  TerminalNotifier.notify('Build finished processing',
121
- title: build.app_name,
122
- subtitle: "#{build.train_version} (#{build.build_version})",
131
+ title: app.name,
132
+ subtitle: "#{build.app_version} (#{build.version})",
123
133
  execute: "open '#{url}'")
124
134
  end
125
135
 
126
- def find_build
127
- build = nil
128
- app.latest_version.candidate_builds.each do |b|
129
- build = b if !build || b.upload_date > build.upload_date
136
+ # Finds a build if none given
137
+ # Otherwise fetches a build (to get updated state)
138
+ def find_build(build)
139
+ if build.nil?
140
+ build = app.get_builds(includes: Spaceship::ConnectAPI::Build::ESSENTIAL_INCLUDES).select do |build|
141
+ build.processing_state == Spaceship::ConnectAPI::Build::ProcessingState::PROCESSING
142
+ end.sort_by(&:uploaded_date).last
143
+ else
144
+ build = Spaceship::ConnectAPI::Build.get(build_id: build.id, includes: Spaceship::ConnectAPI::Build::ESSENTIAL_INCLUDES)
130
145
  end
131
146
 
132
147
  unless build
133
- UI.user_error!("No processing builds available for app #{WatchBuild.config[:app_identifier]}")
148
+ UI.error("No processing builds available for app #{WatchBuild.config[:app_identifier]} - this may take a few minutes (check your email for processing issues if this continues)")
134
149
  end
135
150
 
136
151
  build
@@ -1,4 +1,4 @@
1
1
  module WatchBuild
2
- VERSION = '0.4.0'.freeze
2
+ VERSION = '0.5.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.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-05 00:00:00.000000000 Z
11
+ date: 2021-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastlane
@@ -204,8 +204,7 @@ 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.7.6.2
207
+ rubygems_version: 3.1.4
209
208
  signing_key:
210
209
  specification_version: 4
211
210
  summary: Get a notification once your App Store Connect build is finished processing