Skip to content

Commit

Permalink
Fixed Octopus Deploy upload (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmus authored May 15, 2022
1 parent 2d483f4 commit 84487f2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 0.15-beta

* *Nothing yet...*
* Fixed: Actually a working upload to Octopus Deploy

# 0.14-beta

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 84487f2

Please sign in to comment.