Skip to content

Instantly share code, notes, and snippets.

@Dalmirog-zz
Created April 10, 2015 13:45
Show Gist options
  • Save Dalmirog-zz/1243ec316473c564471d to your computer and use it in GitHub Desktop.
Save Dalmirog-zz/1243ec316473c564471d to your computer and use it in GitHub Desktop.
Get next Octopus release version
$apiKey = "Your API Key"
$OctopusURL = "Your Octopus URL"
$Header = @{ "X-Octopus-ApiKey" = $apiKey }
$ProjectName = "Your Project Name"
#Getting Environment and Project By Name
$Project = Invoke-WebRequest -Uri "$OctopusURL/api/projects/$ProjectName" -Headers $Header| ConvertFrom-Json
#Getting Deployment Template to get Next version
$dt = Invoke-WebRequest -Uri "$OctopusURL/api/deploymentprocesses/deploymentprocess-$($project.Id)/template" -Headers $Header | ConvertFrom-Json
#$dt.NextVersionIncrement contains the next version
#that Octopus would normally auto-generate based on your
#project versioning strategy set on Projects -> [Project Name] -> Settings
$dt.NextVersionIncrement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment