Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 2 additions & 31 deletions .github/workflows/release-tracking.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# Workflow to register a new application version with both GitHub Releases and Raygun deployment tracking.
# Workflow to register a new application version as a GitHub Release.

# The workflow is triggered when a tag in the format "v1.0.0" is pushed to GitHub.
#
# Learn more about Raygun Deployment Tracking at:
# https://raygun.com/documentation/product-guides/deployment-tracking/overview/
#
# Learn more about the GitHub release action at:
# https://github.com/marketplace/actions/git-release

Expand All @@ -26,34 +23,8 @@ jobs:
contents: write

steps:
- name: Get the version number
id: get_version
run: |
VERSION=${GITHUB_REF_NAME#v}
echo Version: $VERSION
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT

- name: Send to the Raygun Deployments API
id: raygun_deployment
uses: fjogeleit/http-request-action@551353b829c3646756b2ec2b3694f819d7957495
with:
url: https://api.raygun.com/v3/applications/api-key/${{ secrets.RAYGUN_APIKEY }}/deployments
method: POST
bearerToken: ${{ secrets.RAYGUN_AUTHTOKEN }}
data: >-
{
"version": "${{ steps.get_version.outputs.VERSION }}",
"ownerName": "${{ github.event.pusher.name }}",
"emailAddress": "${{ github.event.pusher.email }}",
"scmIdentifier": "${{ github.sha }}",
"scmType": "GitHub"
}

- name: Show Raygun response
run: echo ${{ steps.raygun_deployment.outputs.response }}

- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10

- name: Create GitHub Release
id: github_release
Expand Down
1 change: 0 additions & 1 deletion src/Notifications.API/Notifications.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.2" />
<PackageReference Include="Mindscape.Raygun4Net.AspNetCore" Version="11.2.5" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.18.0.131500">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
3 changes: 2 additions & 1 deletion src/Notifications.API/Platform/AppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ internal static class AppSettings
public static string? Version { get; private set; }
public const string ApiKeys = nameof(ApiKeys);

public static void BindAppSettings(this IServiceCollection services)
public static IServiceCollection BindAppSettings(this IServiceCollection services)
{
Version = GetVersion();
services.AddOptions<List<string>>(ApiKeys).BindConfiguration(configSectionPath: ApiKeys);
return services;
}

private static string GetVersion()
Expand Down
14 changes: 2 additions & 12 deletions src/Notifications.API/Program.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
using Mindscape.Raygun4Net.AspNetCore;
using Notifications.Database;
using Notifications.Platform;
using ZLogger;

var builder = WebApplication.CreateBuilder(args);
builder.Logging.ClearProviders().AddZLoggerConsole(options =>
{
if (builder.Environment.IsDevelopment())
options.UsePlainTextFormatter();
else
options.UseJsonFormatter();
});
builder.Services.AddRaygun(builder.Configuration);
builder.Services.BindAppSettings();
builder.Services.AddApiKeyAuthentication();
builder.Logging.ClearProviders().AddZLoggerConsole(options => options.UseJsonFormatter());
builder.Services.BindAppSettings().AddApiKeyAuthentication();
builder.ConfigureDatabase();

var app = builder.Build();
app.UseRaygun();
app.MapEndpoints();

await app.BuildDatabaseAsync();
Expand Down
3 changes: 0 additions & 3 deletions src/Notifications.API/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
"client-api-key-1",
"client-api-key-2"
],
"RaygunSettings": {
"ApiKey": ""
},
"Logging": {
"LogLevel": {
"Default": "Information",
Expand Down
Loading