Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/Aspire.Hosting/Publishing/Publisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,31 @@ public async Task PublishAsync(DistributedApplicationModel model, CancellationTo
);
}

// Add a step to display the target environment when deploying
if (options.Value.Deploy)
{
var environmentStep = await progressReporter.CreateStepAsync(
"display-environment",
cancellationToken).ConfigureAwait(false);

await using (environmentStep.ConfigureAwait(false))
{
var hostEnvironment = serviceProvider.GetService<Microsoft.Extensions.Hosting.IHostEnvironment>();
var environmentName = hostEnvironment?.EnvironmentName ?? "Production";

var environmentTask = await environmentStep.CreateTaskAsync(
$"Discovering target environment",
cancellationToken)
.ConfigureAwait(false);

await environmentTask.CompleteAsync(
$"Deploying to environment: {environmentName.ToLowerInvariant()}",
CompletionState.Completed,
cancellationToken)
.ConfigureAwait(false);
}
}

// Check if --clear-cache flag is set and prompt user before deleting deployment state
if (options.Value.Deploy && options.Value.ClearCache)
{
Expand Down