Skip to content

Instantly share code, notes, and snippets.

@IlyaFinkelshteyn
Last active October 9, 2017 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IlyaFinkelshteyn/a79eb4bd6eb9c59f63e63b23e2713218 to your computer and use it in GitHub Desktop.
Save IlyaFinkelshteyn/a79eb4bd6eb9c59f63e63b23e2713218 to your computer and use it in GitHub Desktop.
$token = '<API_Token>'
$headers = @{
"Authorization" = "Bearer $token"
"Content-type" = "application/json"
}
#if you do not know build version and want to use latest:
#$buildVersion = (Invoke-RestMethod -Uri "https://ci.appveyor.com/api/projects/<Your_account>/<Your_project_slug>" -Headers $headers -Method GET).build.version
#if you need latest build version for specific branch:
#$buildVersion = (Invoke-RestMethod -Uri "https://ci.appveyor.com/api/projects/<Your_account>/<Your_project_slug>/branch/<branch_name>" -Headers $headers -Method GET).build.version
$body = @{
environmentName="<Your_environment>"
accountName="<Your_account>"
projectSlug="<Your_project_slug>"
# $env:APPVEYOR_BUILD_VERSION can be used when calling from build job
# or $buildVersion if you are calling separately (see how we get it above commented)
buildVersion="<build_version_to_deploy>"
environmentVariables = @{
my_var=$myVar
}
}
$body = $body | ConvertTo-Json
Invoke-RestMethod -Uri 'https://ci.appveyor.com/api/deployments' -Headers $headers -Body $body -Method POST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment