Created
October 30, 2014 04:13
-
-
Save DamianMac/cab420adb9f9a915b028 to your computer and use it in GitHub Desktop.
Create a release with Octopus Client API
This file contains 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 server = "http://yourserveraddress:8065/"; //Your server and IP address | |
var apiKey = "API-XXXXXXXXXXXXXXXXXXXXXXXXX"; // Get this from your 'profile' page in the Octopus web portal | |
var endpoint = new OctopusServerEndpoint(server, apiKey); | |
var repository = new OctopusRepository(endpoint); | |
var projectId = "projects-225"; //your project id | |
//This pulls out the info you need, the same call that's made on the Create Release page in the UI | |
var template = repository.Client.Get<Octopus.Client.Model.ReleaseTemplateResource>("/api/deploymentprocesses/deploymentprocess-" + projectId + "/template"); | |
var release = new Octopus.Client.Model.ReleaseResource(); | |
release.Version = template.NextVersionIncrement;; | |
release.ProjectId = projectId; | |
foreach (var package in template.Packages) | |
{ | |
release.SelectedPackages.Add(new Octopus.Client.Model.SelectedPackage(package.StepName, package.VersionSelectedLastRelease)); //Use a new package version if you know it | |
} | |
var result = repository.Releases.Create(release); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, this works.
```
var endpoint = new OctopusServerEndpoint("http://localhost:8099", "API-XXXXXXXXXXXXXXXXXXXXX");
var repository = new OctopusRepository(endpoint);