Skip to content

Instantly share code, notes, and snippets.

@Dalmirog-zz
Created May 8, 2015 14:57
Show Gist options
  • Save Dalmirog-zz/ff38095bdd26c290276c to your computer and use it in GitHub Desktop.
Save Dalmirog-zz/ff38095bdd26c290276c to your computer and use it in GitHub Desktop.
Add artifact to release
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