From 9b8b9c4188ff6073d80223757f4061d55fa25dd2 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Fri, 20 Mar 2026 08:51:46 +0000 Subject: [PATCH 1/2] Add Sentry integration and versioned release publishing Integrated Sentry.AspNetCore for error tracking, configured via DSN and environment in Program.cs. Updated CI to pass version info to dotnet publish for release builds. No changes to core app logic. --- .github/workflows/createrelease.yml | 4 ++++ .../MobileConfiguration.csproj | 1 + MobileConfiguration/Program.cs | 20 +++++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/.github/workflows/createrelease.yml b/.github/workflows/createrelease.yml index 44101ab..723396f 100644 --- a/.github/workflows/createrelease.yml +++ b/.github/workflows/createrelease.yml @@ -47,6 +47,10 @@ jobs: - name: Publish API if: ${{ github.event.release.prerelease == false }} run: dotnet publish "MobileConfiguration\MobileConfiguration.csproj" --configuration Release --output publishOutput -r win-x64 --self-contained + -p:Version=${{ steps.get_version.outputs.VERSION }} + -p:AssemblyVersion=${{ steps.get_version.outputs.VERSION }} + -p:FileVersion=${{ steps.get_version.outputs.VERSION }} + -p:InformationalVersion=${{ steps.get_version.outputs.VERSION }} - name: Build Release Package run: | diff --git a/MobileConfiguration/MobileConfiguration.csproj b/MobileConfiguration/MobileConfiguration.csproj index 73c1d34..a6e8a38 100644 --- a/MobileConfiguration/MobileConfiguration.csproj +++ b/MobileConfiguration/MobileConfiguration.csproj @@ -77,6 +77,7 @@ + diff --git a/MobileConfiguration/Program.cs b/MobileConfiguration/Program.cs index 94436ea..60c3425 100644 --- a/MobileConfiguration/Program.cs +++ b/MobileConfiguration/Program.cs @@ -7,6 +7,7 @@ using MobileConfiguration.Repository; using NLog; using NLog.Extensions.Logging; +using Sentry.Extensibility; using Shared.EntityFramework; using Shared.Extensions; using Shared.General; @@ -30,6 +31,25 @@ ConfigurationReader.Initialise(configuration); +// Configure Sentry on the webBuilder using the config snapshot. +var sentrySection = ConfigurationReader.GetValueOrDefault("SentryConfiguration", "Dsn", "N/A"); +if (sentrySection != "N/A") +{ + // Replace the condition below if you intended to only enable Sentry in certain environments. + if (builder.Environment.IsDevelopment() == false) + { + builder.WebHost.UseSentry(o => + { + o.Dsn = sentrySection; + o.SendDefaultPii = true; + o.MaxRequestBodySize = RequestSize.Always; + o.CaptureBlockingCalls = true; + o.Release = Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "unknown"; + }); + } +} + + String contentRoot = Directory.GetCurrentDirectory(); String nlogConfigPath = Path.Combine(contentRoot, "nlog.config"); From 9da3cba5323e0512ce537be014e0683ce0c47ba9 Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Fri, 20 Mar 2026 08:55:25 +0000 Subject: [PATCH 2/2] Delete .github/workflows/prlinked.yml --- .github/workflows/prlinked.yml | 47 ---------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 .github/workflows/prlinked.yml diff --git a/.github/workflows/prlinked.yml b/.github/workflows/prlinked.yml deleted file mode 100644 index 84037c8..0000000 --- a/.github/workflows/prlinked.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Move Linked Issues - -on: - pull_request: - types: - - opened - - synchronize - - reopened - -jobs: - get-date: - runs-on: ubuntu-latest - outputs: - project_name_prefix: ${{ steps.format_date.outputs.formatted_date }} - steps: - - name: Get PR creation date - id: format_date - run: | - # Extract the month and year from the PR creation date - PR_DATE="${{ github.event.pull_request.created_at }}" - FORMATTED_DATE=$(date -d "$PR_DATE" "+%B %Y") # Format to Month Year - - # Debugging: print out the formatted date - echo "Formatted Date: ${FORMATTED_DATE} Sprint" - - # Set output using the Environment File method - echo "formatted_date=${FORMATTED_DATE} Sprint" >> $GITHUB_OUTPUT # Set the output for later jobs - - debug-date: - needs: get-date - runs-on: ubuntu-latest - steps: - - name: Debug the outputs - run: | - echo "PR Number: ${{ github.event.pull_request.number }}" - echo "Project Column Name: Review" - echo "Project Name Prefix (from get-date job output): ${{ needs.get-date.outputs.project_name_prefix }}" # Access the output correctly - - move-issues: - needs: get-date - uses: TransactionProcessing/org-ci-workflows/.github/workflows/move-linked-issue.yml@main - with: - pr_number: ${{ github.event.pull_request.number }} - project_column_name: "Review" - project_name_prefix: ${{ needs.get-date.outputs.project_name_prefix }} # Access the output from get-date job - secrets: - gh_token: ${{ secrets.GH_TOKEN }}