Skip to content

Commit 1c33b86

Browse files
committed
Log the package file size
1 parent 3f0aee1 commit 1c33b86

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/Commands/Deploy.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -258,25 +258,29 @@ private function uploadArtifacts(array $config, array $packageUrls): void
258258

259259
IO::spin('uploading');
260260

261+
$client = HttpClient::create([
262+
'timeout' => 10,
263+
'headers' => [
264+
'User-Agent' => 'Bref CLI',
265+
'Content-Type' => 'application/json',
266+
'Accept' => 'application/json',
267+
],
268+
]);
269+
261270
foreach ($archivePaths as $id => $archivePath) {
262271
$url = $packageUrls[$id];
263272

264-
$client = HttpClient::create([
265-
'timeout' => 10,
266-
'headers' => [
267-
'User-Agent' => 'Bref CLI',
268-
'Content-Type' => 'application/json',
269-
'Accept' => 'application/json',
270-
],
271-
]);
273+
IO::verbose(sprintf(
274+
'Uploading %s (%d MB)',
275+
$archivePath,
276+
round(((float) filesize($archivePath)) / 1024. / 1024., 1)
277+
));
272278

273279
// Note: Symfony suggests using `fopen()` to stream the content, but S3 does not
274280
// support streaming that way and throws a 501 Not Implemented exception.
275281
// Sending the entire file in one batch works fine, but this likely
276282
// creates a blocking operation for the CLI.
277283
$client->request('PUT', $url, ['body' => file_get_contents($archivePath)]);
278-
279-
IO::verbose("Uploading $archivePath");
280284
}
281285
}
282286

0 commit comments

Comments
 (0)