diff --git a/src/Commands/DeployCommand.php b/src/Commands/DeployCommand.php index 49712bb6..47322de3 100644 --- a/src/Commands/DeployCommand.php +++ b/src/Commands/DeployCommand.php @@ -199,6 +199,7 @@ protected function uploadArtifact($environment, $uuid) Manifest::id(), $uuid, $environment, + Manifest::regions($environment), Manifest::usesContainerImage($environment) ? null : Path::artifact(), $this->option('commit') ?: Git::hash(), $this->option('message') ?: Git::message(), diff --git a/src/Commands/Output/DeploymentSuccess.php b/src/Commands/Output/DeploymentSuccess.php index 99dc73e7..6250f621 100644 --- a/src/Commands/Output/DeploymentSuccess.php +++ b/src/Commands/Output/DeploymentSuccess.php @@ -54,11 +54,17 @@ protected function displayDnsRecordsChanges(Deployment $deployment) Helpers::line(); } + $records = collect($deployment->regions)->map(function ($region) { + return collect($region['pivot']['target_domains'])->map(function ($target, $domain) use ($region) { + return [$region['region'], $domain, $target['domain']]; + })->values(); + })->flatten(1)->merge(collect($deployment->target_domains)->map(function ($target, $domain) use ($deployment) { + return [$deployment->project['region'], $domain, $target['domain']]; + })->values()); + Helpers::table([ - 'Domain', 'Alias / CNAME', - ], collect($deployment->target_domains)->map(function ($target, $domain) { - return [$domain, $target['domain']]; - })->all()); + 'Region', 'Domain', 'Alias / CNAME', + ], $records->all()); $vapor = Helpers::app(ConsoleVaporClient::class); diff --git a/src/ConsoleVaporClient.php b/src/ConsoleVaporClient.php index 3ac7d025..8357687a 100644 --- a/src/ConsoleVaporClient.php +++ b/src/ConsoleVaporClient.php @@ -1002,6 +1002,7 @@ public function deleteSecret($secretId) * @param int $projectId * @param string $uuid * @param string $environment + * @param array $regions * @param string $file * @param string $commit * @param string $commitMessage @@ -1014,6 +1015,7 @@ public function createArtifact( $projectId, $uuid, $environment, + $regions, $file = null, $commit = null, $commitMessage = null, @@ -1029,6 +1031,7 @@ public function createArtifact( 'cli_version' => $cliVersion, 'core_version' => $coreVersion, 'uses_container_image' => is_null($file), + 'regions' => $regions, ]); if ($file) { diff --git a/src/Manifest.php b/src/Manifest.php index 719afd26..e6ed829c 100644 --- a/src/Manifest.php +++ b/src/Manifest.php @@ -34,6 +34,19 @@ public static function name() return static::current()['name']; } + /** + * Get the regions from the current directory's manifest. + * + * @param string $environment + * @return array + */ + public static function regions($environment) + { + return array_key_exists('regions', static::current()['environments'][$environment]) + ? static::current()['environments'][$environment]['regions'] + : []; + } + /** * Retrieve the manifest for the current working directory. *