Create deployments from GitHub Actions
GitHub Actions is a great platform for building and releasing software. To notify elmah.io when you deploy a new version of your project, you will need an additional step in your build definition. Before you do that, start by creating new secrets:
-
Go to your project on GitHub.
-
Click the Settings tab.
-
Click the Secrets navigation item.
-
Click Add a new secret.
-
Name the secret
ELMAH_IO_API_KEY
. -
Insert your elmah.io API key in Value (Where is my API key?). Make sure to use an API key that includes the Deployments | Write permission (How to configure API key permissions).
-
Click Add secret
-
Do the same for your elmah.io log ID but name it
ELMAH_IO_LOG_ID
(Where is my log ID?). -
Insert the following step as the last one in your YAML build specification:
- name: Notify elmah.io
shell: powershell
run: |
$ProgressPreference = "SilentlyContinue"
$url = "https://api.elmah.io/v3/deployments?api_key=${{ secrets.ELMAH_IO_API_KEY }}"
$body = @{
version = "${{ github.run_number }}"
userName = "${{ github.actor }}"
logId = "${{ secrets.ELMAH_IO_LOG_ID }}"
}
[Net.ServicePointManager]::SecurityProtocol = `
[Net.SecurityProtocolType]::Tls12,
[Net.SecurityProtocolType]::Tls11,
[Net.SecurityProtocolType]::Tls
Invoke-RestMethod -Method Post -Uri $url -Body $body
This article was brought to you by the elmah.io team. elmah.io is the best error management system for .NET web applications. We monitor your website, alert you when errors start happening and help you fix errors fast.
See how we can help you monitor your website for crashes Monitor your website