diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 6aa937c2..4079f68b 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,6 +1,6 @@ # 0.15-beta -* *Nothing yet...* +* Fixed: Actually a working upload to Octopus Deploy # 0.14-beta diff --git a/Source/Bake/Cooking/Cooks/OctopusDeploy/OctopusDeployPackagePushCook.cs b/Source/Bake/Cooking/Cooks/OctopusDeploy/OctopusDeployPackagePushCook.cs index b4d65e8d..dfe77c21 100644 --- a/Source/Bake/Cooking/Cooks/OctopusDeploy/OctopusDeployPackagePushCook.cs +++ b/Source/Bake/Cooking/Cooks/OctopusDeploy/OctopusDeployPackagePushCook.cs @@ -21,8 +21,10 @@ // SOFTWARE. using System; +using System.IO; using System.Linq; using System.Net.Http; +using System.Net.Http.Headers; using System.Threading; using System.Threading.Tasks; using Bake.Core; @@ -83,12 +85,26 @@ private async Task UploadAsync( HttpClient httpClient, CancellationToken cancellationToken) { - url = new Uri(url, "/api/packages/raw"); + url = new Uri(url, "/api/packages/raw?replace=false"); var file = _fileSystem.Open(packagePath); await using var stream = await file.OpenReadAsync(cancellationToken); using var request = new HttpRequestMessage(HttpMethod.Post, url) { - Content = new StreamContent(stream), + Content = new MultipartFormDataContent + { + new StreamContent(stream) + { + Headers = + { + ContentType = new MediaTypeHeaderValue("multipart/form-data"), + ContentDisposition = new ContentDispositionHeaderValue("form-data") + { + Name = "fileData", + FileName = Path.GetFileName(packagePath) + } + } + } + }, Headers = { {"X-Octopus-ApiKey", apiKey} diff --git a/Source/Bake/ValueObjects/Recipes/OctopusDeploy/OctopusDeployPackagePushRecipe.cs b/Source/Bake/ValueObjects/Recipes/OctopusDeploy/OctopusDeployPackagePushRecipe.cs index 21aa540e..fe780e52 100644 --- a/Source/Bake/ValueObjects/Recipes/OctopusDeploy/OctopusDeployPackagePushRecipe.cs +++ b/Source/Bake/ValueObjects/Recipes/OctopusDeploy/OctopusDeployPackagePushRecipe.cs @@ -28,7 +28,7 @@ namespace Bake.ValueObjects.Recipes.OctopusDeploy [Recipe(Names.Recipes.OctopusDeploy.PackageRawPush)] public class OctopusDeployPackagePushRecipe : Recipe { - [YamlMember] + [YamlMember(SerializeAs = typeof(string))] public Uri Url { get; [Obsolete] set; } [YamlMember]