From cb8632e4659a0668d3bedebf2f3e4b7e43125867 Mon Sep 17 00:00:00 2001 From: Alexandros Patsouros Date: Thu, 24 Sep 2026 21:00:29 +0300 Subject: [PATCH] Add GitHub Actions workflow with NuGet trusted publishing Replace AppVeyor (which deployed upstream's package with upstream's encrypted secrets) with .github/workflows/publish.yml: - Build and pack on windows-latest for every push to master, pull request and manual run; upload packages as artifacts with a -ci. prerelease version. - On v* tags, publish to nuget.org using trusted publishing (GitHub OIDC -> NuGet/login -> short-lived API key); no stored key. Package metadata: - Publish under the fork-owned ID d3sync.CrashReporter.NET, since CrashReporter.NET.Official is owned by RBSoft. - Add repository info, package README and snupkg symbols. - Derive AssemblyVersion/FileVersion from Version so tag builds stamp the correct assembly version. Co-Authored-By: Claude Opus 5.5 (1M context) --- .github/workflows/publish.yml | 89 ++++++++++++++++++++++ CrashReporter.NET.sln | 1 - CrashReporter.NET/CrashReporter.NET.csproj | 20 +++-- README.md | 6 +- appveyor.yml | 49 ------------ 5 files changed, 106 insertions(+), 59 deletions(-) create mode 100644 .github/workflows/publish.yml delete mode 100644 appveyor.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..ead9ef5 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,89 @@ +name: Build and publish + +on: + push: + branches: [ master ] + tags: [ 'v*' ] # pushing a tag like v2.0.0 publishes version 2.0.0 to nuget.org + pull_request: + workflow_dispatch: + +permissions: + contents: read + +env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + +jobs: + build: + # net48 and Windows Forms targets require a Windows runner. + runs-on: windows-latest + steps: + - uses: actions/checkout@v7 + + - uses: actions/setup-dotnet@v6 + with: + dotnet-version: 10.0.x + + - name: Determine package version + id: version + shell: pwsh + run: | + if ($env:GITHUB_REF -like 'refs/tags/v*') { + $version = $env:GITHUB_REF_NAME.Substring(1) + } else { + # Non-release builds get a unique prerelease version; they are built and uploaded as artifacts only. + [xml]$project = Get-Content CrashReporter.NET/CrashReporter.NET.csproj + $base = ($project.Project.PropertyGroup | Where-Object { $_.Version } | Select-Object -First 1).Version + $version = "$base-ci.$env:GITHUB_RUN_NUMBER" + } + "version=$version" >> $env:GITHUB_OUTPUT + Write-Host "Package version: $version" + + - name: Restore + run: dotnet restore CrashReporter.NET.sln + + - name: Build + run: dotnet build CrashReporter.NET.sln -c Release --no-restore -p:Version=${{ steps.version.outputs.version }} -p:ContinuousIntegrationBuild=true + + - name: Pack + run: dotnet pack CrashReporter.NET/CrashReporter.NET.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.version }} -o artifacts + + - uses: actions/upload-artifact@v7 + with: + name: packages + path: | + artifacts/*.nupkg + artifacts/*.snupkg + if-no-files-found: error + + publish: + needs: build + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + # Optional: add protection rules (e.g. required reviewers) to this environment in the repository settings. + environment: release + permissions: + id-token: write # required to request the GitHub OIDC token used by NuGet trusted publishing + contents: read + steps: + - uses: actions/download-artifact@v8 + with: + name: packages + path: artifacts + + - uses: actions/setup-dotnet@v6 + with: + dotnet-version: 10.0.x + + # Exchanges the GitHub OIDC token for a short-lived (1 hour) nuget.org API key. + - name: NuGet login (OIDC → temporary API key) + id: login + uses: NuGet/login@v1 + with: + user: ${{ secrets.NUGET_USER }} # nuget.org profile name (not e-mail) + + # Pushing the .nupkg also pushes the matching .snupkg symbol package. + - name: Push to nuget.org + shell: bash + run: dotnet nuget push "artifacts/*.nupkg" --api-key "${{ steps.login.outputs.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate diff --git a/CrashReporter.NET.sln b/CrashReporter.NET.sln index 6bba9d8..71cd9c6 100644 --- a/CrashReporter.NET.sln +++ b/CrashReporter.NET.sln @@ -11,7 +11,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CrashReporterWPFTest", "Cra EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{475926B8-4252-47B1-BD51-FD60F5445535}" ProjectSection(SolutionItems) = preProject - appveyor.yml = appveyor.yml LICENSE = LICENSE nuget.config = nuget.config README.md = README.md diff --git a/CrashReporter.NET/CrashReporter.NET.csproj b/CrashReporter.NET/CrashReporter.NET.csproj index 085f624..9f82477 100644 --- a/CrashReporter.NET/CrashReporter.NET.csproj +++ b/CrashReporter.NET/CrashReporter.NET.csproj @@ -11,9 +11,8 @@ + 2.0.0 - 2.0.0.0 - 2.0.0.0 RBSoft CrashReporter.NET CrashReporter.NET @@ -27,12 +26,17 @@ - CrashReporter.NET.Official + d3sync.CrashReporter.NET CrashReporter.NET - RBSoft + RBSoft, d3sync MIT - https://github.com/ravibpatel/CrashReporter.NET - https://github.com/ravibpatel/CrashReporter.NET/releases + https://github.com/d3sync/CrashReporter.NET + https://github.com/d3sync/CrashReporter.NET + git + https://github.com/d3sync/CrashReporter.NET/releases + README.md + true + snupkg Send crash reports of your desktop application developed using .NET 10 or .NET Framework 4.8 directly to your mail's inbox with full exception report, stack trace and screenshot. exception reporter crash inbox email C# VB.NET WinForms WPF false @@ -43,6 +47,10 @@ true + + + + diff --git a/README.md b/README.md index 7e0ee71..8f7f30f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # CrashReporter.NET -[![AppVeyor branch](https://img.shields.io/appveyor/ci/gruntjs/grunt/master.svg)](https://ci.appveyor.com/project/ravibpatel/crashreporter-net) +[![Build and publish](https://github.com/d3sync/CrashReporter.NET/actions/workflows/publish.yml/badge.svg)](https://github.com/d3sync/CrashReporter.NET/actions/workflows/publish.yml) Send crash reports of your desktop application developed using .NET 10 or .NET Framework directly to your mail's inbox with full exception report, stack trace and screenshot. @@ -20,10 +20,10 @@ Version 2.0 is a breaking release: * Failed reports saved by `SaveFailedReport()` are now stored as `failed-report-*.xml` instead of `BinaryFormatter` based `.bin` files, because `BinaryFormatter` is no longer available on .NET 9+. Old `.bin` files are not retried. * Translations are now shipped as standard satellite assemblies (`de\CrashReporter.NET.resources.dll`, etc.) instead of being embedded in `CrashReporter.NET.dll`. Deploy the culture folders along with your application. -## The nuget package [![NuGet](https://img.shields.io/nuget/v/CrashReporter.NET.Official.svg)](https://www.nuget.org/packages/CrashReporter.NET.Official/) [![NuGet](https://img.shields.io/nuget/dt/CrashReporter.NET.Official.svg)](https://www.nuget.org/packages/CrashReporter.NET.Official/) +## The nuget package [![NuGet](https://img.shields.io/nuget/v/d3sync.CrashReporter.NET.svg)](https://www.nuget.org/packages/d3sync.CrashReporter.NET/) [![NuGet](https://img.shields.io/nuget/dt/d3sync.CrashReporter.NET.svg)](https://www.nuget.org/packages/d3sync.CrashReporter.NET/) ````powershell -PM> Install-Package CrashReporter.NET.Official +PM> Install-Package d3sync.CrashReporter.NET ```` ## How it works diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 6d567c9..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,49 +0,0 @@ -version: 2.0.0.{build} -environment: - my_version: 2.0.0 - my_secret: - secure: eXAIysIG8npt2tVMYQpGwTLj47CK9lUB/NyEfVGgc90= -skip_branch_with_pr: true -image: Visual Studio 2022 -clone_folder: c:\projects\CrashReporter.NET -build: off -platform: Any CPU -configuration: Release -install: -- nuget install secure-file -ExcludeVersion -- secure-file\tools\secure-file -decrypt "c:\projects\CrashReporter.NET\CrashReporter.NET\CrashReporter.NET.snk.enc" -secret %my_secret% -- ps: | - Invoke-WebRequest -Uri 'https://dot.net/v1/dotnet-install.ps1' -OutFile dotnet-install.ps1 - ./dotnet-install.ps1 -Channel 10.0 -InstallDir "$env:ProgramFiles\dotnet" -- dotnet --info - -build_script: -- dotnet build "c:\projects\CrashReporter.NET\CrashReporter.NET.sln" -c Release -- dotnet pack "c:\projects\CrashReporter.NET\CrashReporter.NET\CrashReporter.NET.csproj" -c Release --no-build -o "c:\projects\CrashReporter.NET" -- cmd: 7z a CrashReporter.NET-%my_version%.zip %APPVEYOR_BUILD_FOLDER%\CrashReporter.NET\bin\Release\* - -artifacts: -- path: CrashReporter.NET-%my_version%.zip -- path: CrashReporter.NET.Official.%my_version%.nupkg - -deploy: -- provider: GitHub - release: $(APPVEYOR_REPO_TAG_NAME) - description: '// TODO: Write Release Notes' - artifact: CrashReporter.NET-%my_version%.zip - auth_token: - secure: WHW27Nvc8zNhfyhxIYdl/NwbrkFzvSX0vE4/CS8iByPXM6rcztWhUrDXJ7eejLBY - draft: false - prerelease: false - on: - branch: master # release from master branch only - appveyor_repo_tag: true # deploy on tag push only - -- provider: NuGet - api_key: - secure: tmlnRHVMwKGZ1B+ua5hte55Ig+gfbTi4DjKzzTiRjNwpy9nYgQpDZCnQZB0H9IdS - skip_symbols: false - artifact: CrashReporter.NET.Official.%my_version%.nupkg - on: - branch: master # release from master branch only - appveyor_repo_tag: true # deploy on tag push only