Using Powershell

Get an Auth Token

Generate an External Auth Token for your build server to use from your Raygun User Settings page


Add script

Add this script somewhere your deployment process can use it:

[CmdletBinding()]
Param(
    [Parameter(Mandatory=$True)]
    [string] $raygunAuthToken,
    [Parameter(Mandatory=$True)]
    [string] $raygunApiKey,
    [Parameter(Mandatory=$True)]
    [string] $version,
    [Parameter(Mandatory=$True)]
    [string] $ownerName,
    [Parameter(Mandatory=$True)]
    [string] $emailAddress,
    [Parameter()]
    [string] $scmIdentifier,
    [Parameter()]
    [string] $releaseNotes
)

Write-Debug "Adding deployment in Raygun"
$url = "https://app.raygun.io/deployments?authToken=" + $raygunAuthToken

$command = ConvertTo-Json @{
    apiKey = $raygunApiKey
    version = $version
    ownerName = $ownerName
    emailAddress = $emailAddress
    comment = $releaseNotes
	scmIdentifier = $scmIdentifier
}

$bytes = [System.Text.Encoding]::ASCII.GetBytes($command)
$web = [System.Net.WebRequest]::Create($url)
$web.Method = "POST"
$web.ContentLength = $bytes.Length
$web.ContentType = "application/json"
$stream = $web.GetRequestStream()
$stream.Write($bytes,0,$bytes.Length)
$stream.close()

$response = [System.Net.HttpWebResponse]$web.GetResponse()
if($response.StatusCode -eq [System.Net.HttpStatusCode]::OK) {
    Write-Debug "Added deployment in Raygun"
} else {
    Write-Host "Error received when adding deployment in Raygun: " $response.StatusCode " - " $response.StatusDescription
}

Call the script

Call the deployment script after your release process is finished.

-raygunAuthToken   Your External Auth Token
-raygunApiKey      Your Application API Key
-version           The version of your application that you've just deployed
-ownerName         The name of the user who created this deployment
-scmIdentifier     The identifier of the commit that this release was built from.
-emailAddress      The email address of the user who created this deployment
                   (should be a raygun user)
-releaseNotes      The release notes for this deployment. Will be formatted as Markdown.