From b00183b03e1f032dbbfc089ccf42d11986a3c618 Mon Sep 17 00:00:00 2001 From: Caelan Sayler Date: Tue, 24 Dec 2024 14:57:59 +0000 Subject: [PATCH] auto create channel --- src/vpk/Velopack.Flow/VelopackFlowServiceClient.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/vpk/Velopack.Flow/VelopackFlowServiceClient.cs b/src/vpk/Velopack.Flow/VelopackFlowServiceClient.cs index 587b8fc3..788629d5 100644 --- a/src/vpk/Velopack.Flow/VelopackFlowServiceClient.cs +++ b/src/vpk/Velopack.Flow/VelopackFlowServiceClient.cs @@ -196,6 +196,8 @@ public class VelopackFlowServiceClient( $"Creating release {version}", async (report) => { report(-1); + await CreateChannelIfNotExists(packageId, channel, cancellationToken); + report(50); var result = await CreateReleaseGroupAsync(packageId, version, channel, cancellationToken); report(100); return result; @@ -312,6 +314,16 @@ public class VelopackFlowServiceClient( Logger.LogWarning("Release did not go live within 5 minutes (timeout)."); } + private async Task CreateChannelIfNotExists(string packageId, string channel, CancellationToken cancellationToken) + { + var request = new CreateChannelRequest() { + PackageId = packageId, + Name = channel, + }; + var client = GetFlowApi(); + await client.CreateChannelAsync(request, cancellationToken); + } + private async Task CreateReleaseGroupAsync(string packageId, SemanticVersion version, string channel, CancellationToken cancellationToken) { CreateReleaseGroupRequest request = new() {