Created
May 8, 2015 14:57
-
-
Save Dalmirog-zz/ff38095bdd26c290276c to your computer and use it in GitHub Desktop.
Add artifact to release
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var endpoint = new Octopus.Client.OctopusServerEndpoint(baseUri, apiKey); | |
var repository = new Octopus.Client.OctopusRepository(endpoint); | |
var project = repository.Projects.FindByName(projectName); | |
var release = repository.Projects.GetReleaseByVersion(project, releaseVersion); | |
var artifact = new Octopus.Client.Model.ArtifactResource | |
{ | |
Filename = fileName, | |
RelatedDocumentIds = new Octopus.Platform.Model.ReferenceCollection(new [] { project.Id, release.Id }) | |
}; | |
var createdArtifact = repository.Artifacts.Create(artifact); | |
createdArtifact.Dump(); | |
using(var file = File.OpenRead(filePath)) | |
{ | |
repository.Artifacts.PutContent(createdArtifact, file); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment