From fd4f68c34bdbd278c7c391b023d4de5833d9f988 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 24 Sep 2026 19:29:29 +0000 Subject: [PATCH 1/6] Update NuGet packages and move CI from Azure DevOps to GitHub Actions - Bump Microsoft.Extensions.* / System.Text.Json / Mvc.Testing to 10.0.12, Grpc.* to 2.84.0, Google.Protobuf to 3.36.2, NuGet.* to 7.9.0, MSTest to 4.4.1, Microsoft.NET.Test.Sdk to 18.10.1, SourceLink to 10.0.401 - Add GitHub Actions build (PR/Development) and release (master) workflows replacing the Azure pipelines, keeping the 7.0.yyMM.ddN version scheme - Treat GitHub Actions as a CI build for deterministic packages - Point the README badge at the new release workflow Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01YZQGUHTkBDHX7av2o9Uqf5 --- .github/workflows/build.yml | 39 ++++++++ .github/workflows/release.yml | 99 +++++++++++++++++++ ...DSoft.Portable.WebClient.Encryption.csproj | 4 +- ....Portable.WebClient.Grpc.Encryption.csproj | 4 +- ....Portable.WebClient.Grpc.Extensions.csproj | 2 +- .../DSoft.Portable.WebClient.Grpc.csproj | 6 +- .../DSoft.Portable.WebClient.Rest.csproj | 6 +- DSoft.Portable.WebClient.slnx | 4 +- Directory.Build.props | 4 +- README.md | 2 +- RpcSample/RpcSample.csproj | 6 +- SampleApiClient/SampleApiClient.csproj | 2 +- SampleWebApp/SampleWebApp.csproj | 8 +- UnitTester/UnitTester.csproj | 12 +-- azure-pipelines-mergetest.yml | 38 ------- azure-pipelines-release.yml | 63 ------------ 16 files changed, 168 insertions(+), 131 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/release.yml delete mode 100644 azure-pipelines-mergetest.yml delete mode 100644 azure-pipelines-release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..abf05de --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,39 @@ +# Build and test on pull requests and pushes to Development +# (replaces azure-pipelines-mergetest.yml) +name: Build + +on: + pull_request: + push: + branches: [ Development ] + paths-ignore: + - '**.md' + workflow_dispatch: + +env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + SOLUTION: DSoft.Portable.WebClient.slnx + BUILD_CONFIGURATION: Release + +jobs: + build: + # windows is required for the WPF TestHarness (net10.0-windows) and the net462 targets + runs-on: windows-latest + + steps: + - uses: actions/checkout@v5 + + - name: Install .NET SDK + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 10.0.x + + - name: Restore packages + run: dotnet restore ${{ env.SOLUTION }} + + - name: Build + run: dotnet build ${{ env.SOLUTION }} --no-restore --configuration ${{ env.BUILD_CONFIGURATION }} + + - name: Test + run: dotnet test UnitTester/UnitTester.csproj --no-build --configuration ${{ env.BUILD_CONFIGURATION }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..41b04c9 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,99 @@ +# Build, test and package on pushes to master +# (replaces azure-pipelines-release.yml) +name: Release + +on: + push: + branches: [ master ] + paths-ignore: + - '**.md' + - '.github/workflows/build.yml' + workflow_dispatch: + inputs: + publish: + description: 'Push the packages to nuget.org (requires the NUGET_API_KEY secret)' + type: boolean + default: false + +env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + SOLUTION: DSoft.Portable.WebClient.slnx + BUILD_CONFIGURATION: Release + MAJOR_MINOR: '7.0' + RELEASE_SUFFIX: '-prerelease' + +concurrency: + group: release + cancel-in-progress: false + +permissions: + contents: read + actions: read + +jobs: + release: + # windows is required for the WPF TestHarness (net10.0-windows) and the net462 targets + runs-on: windows-latest + + steps: + - uses: actions/checkout@v5 + + - name: Install .NET SDK + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 10.0.x + + # Same scheme as the old Azure pipeline: {major}.{minor}.{yyMM}.{dd}{daily revision} + - name: Calculate version + id: version + shell: pwsh + env: + GH_TOKEN: ${{ github.token }} + run: | + $now = [DateTime]::UtcNow + $since = $now.ToString('yyyy-MM-dd') + $runs = gh run list --repo "${{ github.repository }}" --workflow release.yml --created ">=$since" --limit 100 --json databaseId,createdAt | ConvertFrom-Json + $rev = @($runs | Where-Object { $_.databaseId -le ${{ github.run_id }} }).Count + if ($rev -lt 1) { $rev = 1 } + $version = "$env:MAJOR_MINOR.$($now.ToString('yyMM')).$($now.ToString('dd'))$rev" + "version=$version" >> $env:GITHUB_OUTPUT + Write-Host "Version: $version$env:RELEASE_SUFFIX" + + - name: Restore packages + run: dotnet restore ${{ env.SOLUTION }} + + - name: Build + run: > + dotnet build ${{ env.SOLUTION }} --no-restore + --configuration ${{ env.BUILD_CONFIGURATION }} + /p:Version=${{ steps.version.outputs.version }}${{ env.RELEASE_SUFFIX }} + /p:AssemblyVersion=${{ steps.version.outputs.version }} + /p:FileVersion=${{ steps.version.outputs.version }} + + - name: Test + run: dotnet test UnitTester/UnitTester.csproj --no-build --configuration ${{ env.BUILD_CONFIGURATION }} + + - name: Collect packages + shell: pwsh + run: | + New-Item -ItemType Directory -Force -Path artifacts | Out-Null + Get-ChildItem -Recurse -Include 'DSoft.*.nupkg','DSoft.*.snupkg' -Path . | + Where-Object { $_.FullName -notmatch '[\\/]artifacts[\\/]' } | + Copy-Item -Destination artifacts + Get-ChildItem artifacts + + - name: Upload packages + uses: actions/upload-artifact@v4 + with: + name: drop + path: artifacts/* + + - name: Push to nuget.org + if: ${{ github.event_name == 'workflow_dispatch' && inputs.publish }} + shell: pwsh + env: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} + run: | + if (-not $env:NUGET_API_KEY) { throw 'NUGET_API_KEY secret is not set' } + dotnet nuget push "artifacts/*.nupkg" --api-key $env:NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate diff --git a/DSoft.Portable.WebClient.Encryption/DSoft.Portable.WebClient.Encryption.csproj b/DSoft.Portable.WebClient.Encryption/DSoft.Portable.WebClient.Encryption.csproj index 859d558..f8f87aa 100644 --- a/DSoft.Portable.WebClient.Encryption/DSoft.Portable.WebClient.Encryption.csproj +++ b/DSoft.Portable.WebClient.Encryption/DSoft.Portable.WebClient.Encryption.csproj @@ -28,8 +28,8 @@ - - + + diff --git a/DSoft.Portable.WebClient.Grpc.Encryption/DSoft.Portable.WebClient.Grpc.Encryption.csproj b/DSoft.Portable.WebClient.Grpc.Encryption/DSoft.Portable.WebClient.Grpc.Encryption.csproj index b4df488..76181bf 100644 --- a/DSoft.Portable.WebClient.Grpc.Encryption/DSoft.Portable.WebClient.Grpc.Encryption.csproj +++ b/DSoft.Portable.WebClient.Grpc.Encryption/DSoft.Portable.WebClient.Grpc.Encryption.csproj @@ -15,9 +15,9 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/DSoft.Portable.WebClient.Grpc.Extensions/DSoft.Portable.WebClient.Grpc.Extensions.csproj b/DSoft.Portable.WebClient.Grpc.Extensions/DSoft.Portable.WebClient.Grpc.Extensions.csproj index db17a9c..5d224b6 100644 --- a/DSoft.Portable.WebClient.Grpc.Extensions/DSoft.Portable.WebClient.Grpc.Extensions.csproj +++ b/DSoft.Portable.WebClient.Grpc.Extensions/DSoft.Portable.WebClient.Grpc.Extensions.csproj @@ -17,7 +17,7 @@ - + diff --git a/DSoft.Portable.WebClient.Grpc/DSoft.Portable.WebClient.Grpc.csproj b/DSoft.Portable.WebClient.Grpc/DSoft.Portable.WebClient.Grpc.csproj index 5547646..c472e97 100644 --- a/DSoft.Portable.WebClient.Grpc/DSoft.Portable.WebClient.Grpc.csproj +++ b/DSoft.Portable.WebClient.Grpc/DSoft.Portable.WebClient.Grpc.csproj @@ -17,9 +17,9 @@ - - - + + + diff --git a/DSoft.Portable.WebClient.Rest/DSoft.Portable.WebClient.Rest.csproj b/DSoft.Portable.WebClient.Rest/DSoft.Portable.WebClient.Rest.csproj index 654c397..620c085 100644 --- a/DSoft.Portable.WebClient.Rest/DSoft.Portable.WebClient.Rest.csproj +++ b/DSoft.Portable.WebClient.Rest/DSoft.Portable.WebClient.Rest.csproj @@ -17,12 +17,12 @@ - + - - + + diff --git a/DSoft.Portable.WebClient.slnx b/DSoft.Portable.WebClient.slnx index ba953b2..d17d6c9 100644 --- a/DSoft.Portable.WebClient.slnx +++ b/DSoft.Portable.WebClient.slnx @@ -22,8 +22,8 @@ - - + + diff --git a/Directory.Build.props b/Directory.Build.props index a5ce506..fb0aac8 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -38,10 +38,10 @@ - + - + true diff --git a/README.md b/README.md index 235a688..a10178b 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ In v3.1 and above the InitVector key is passed explicilty to the `IEncryptionPro `IWebClient` has been removed and now constructors for `GrpcServiceClientBase` and `RestServiceClientBase` receive `GrpcClientOptions` and `RestApiClientOptions` to provide configuration data. ## Build status -[![Build Status](https://dev.azure.com/humbatt/Daves%20Projects/_apis/build/status/PortableWebClient/PortableWebClient%20-%20Release?branchName=master)](https://dev.azure.com/humbatt/Daves%20Projects/_build/latest?definitionId=49&branchName=master) +[![Release](https://github.com/newky2k/PortableWebClient/actions/workflows/release.yml/badge.svg?branch=master)](https://github.com/newky2k/PortableWebClient/actions/workflows/release.yml) diff --git a/RpcSample/RpcSample.csproj b/RpcSample/RpcSample.csproj index 02e8dea..bf48541 100644 --- a/RpcSample/RpcSample.csproj +++ b/RpcSample/RpcSample.csproj @@ -8,10 +8,10 @@ - + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/SampleApiClient/SampleApiClient.csproj b/SampleApiClient/SampleApiClient.csproj index 0707a17..f39e6f8 100644 --- a/SampleApiClient/SampleApiClient.csproj +++ b/SampleApiClient/SampleApiClient.csproj @@ -8,7 +8,7 @@ - + diff --git a/SampleWebApp/SampleWebApp.csproj b/SampleWebApp/SampleWebApp.csproj index d58efd2..a3d96a0 100644 --- a/SampleWebApp/SampleWebApp.csproj +++ b/SampleWebApp/SampleWebApp.csproj @@ -9,10 +9,10 @@ - - - - + + + + diff --git a/UnitTester/UnitTester.csproj b/UnitTester/UnitTester.csproj index ec429bb..6ca547d 100644 --- a/UnitTester/UnitTester.csproj +++ b/UnitTester/UnitTester.csproj @@ -11,16 +11,16 @@ - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/azure-pipelines-mergetest.yml b/azure-pipelines-mergetest.yml deleted file mode 100644 index 4479905..0000000 --- a/azure-pipelines-mergetest.yml +++ /dev/null @@ -1,38 +0,0 @@ -# .NET Desktop -# Build and run tests for .NET Desktop or Windows classic desktop solutions. -# Add steps that publish symbols, save build artifacts, and more: -# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net - -trigger: none - -pool: - vmImage: 'windows-latest' - -variables: - solution: '**/*.slnx' - buildPlatform: 'Any CPU' - buildConfiguration: 'Release' - netVersion: '10.x' - -steps: -- task: NuGetToolInstaller@1 - displayName: Install Latest Nuget - -- task: UseDotNet@2 - displayName: 'Install .NET sdk' - inputs: - packageType: 'sdk' - version: $(netVersion) - -- task: DotNetCoreCLI@2 - displayName: Restore Packages - inputs: - command: 'restore' - projects: '$(solution)' - -- task: DotNetCoreCLI@2 - displayName: dotnet build - inputs: - projects: '$(solution)' - arguments: '--configuration=$(buildConfiguration) /p:Platform="$(buildPlatform)"' - diff --git a/azure-pipelines-release.yml b/azure-pipelines-release.yml deleted file mode 100644 index a27af79..0000000 --- a/azure-pipelines-release.yml +++ /dev/null @@ -1,63 +0,0 @@ -# .NET Desktop -# Build and run tests for .NET Desktop or Windows classic desktop solutions. -# Add steps that publish symbols, save build artifacts, and more: -# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net - -trigger: - batch: true - branches: - include: - - master - paths: - exclude: - - azure-pipelines-release.yml - - readme.md - -pool: - vmImage: 'windows-latest' - -variables: - solution: '**/*.slnx' - buildPlatform: 'Any CPU' - buildConfiguration: 'Release' - releaseSuffix: '-prerelease' - netVersion: '10.x' - -name: 7.0.$(date:yyMM).$(date:dd)$(rev:r) - -steps: -- task: NuGetToolInstaller@1 - displayName: Install Latest Nuget - -- task: UseDotNet@2 - displayName: 'Install .NET sdk' - inputs: - packageType: 'sdk' - version: $(netVersion) - -- task: DotNetCoreCLI@2 - displayName: Restore Packages - inputs: - command: 'restore' - projects: '$(solution)' - -- task: DotNetCoreCLI@2 - displayName: dotnet build - inputs: - projects: '$(solution)' - arguments: '--configuration=$(buildConfiguration) /p:Platform="$(buildPlatform)" /p:Version=$(Build.BuildNumber)$(releaseSuffix) /p:AssemblyVersion=$(Build.BuildNumber) /p:FileVersion=$(Build.BuildNumber) ' - -- task: CopyFiles@2 - displayName: Copy Files to $(build.artifactstagingdirectory) - inputs: - SourceFolder: '$(system.defaultworkingdirectory)' - Contents: '**/Dsoft.*.nupkg' - TargetFolder: '$(build.artifactstagingdirectory)' - flattenFolders: true - -- task: PublishBuildArtifacts@1 - displayName: Publish Artifacts drop - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)' - ArtifactName: 'drop' - publishLocation: 'Container' From 0acca0c4b1661bd1d6d73c65f4bb7b8f0015bbc7 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 25 Sep 2026 18:14:12 +0000 Subject: [PATCH 2/6] Align Encryption package metadata with shared settings (2026 copyright) Remove per-project overrides that duplicated or contradicted Directory.Build.props: 2021 copyright, required licence acceptance and stale v3.1 release notes. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01YZQGUHTkBDHX7av2o9Uqf5 --- .../DSoft.Portable.WebClient.Encryption.csproj | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/DSoft.Portable.WebClient.Encryption/DSoft.Portable.WebClient.Encryption.csproj b/DSoft.Portable.WebClient.Encryption/DSoft.Portable.WebClient.Encryption.csproj index f8f87aa..bc21e13 100644 --- a/DSoft.Portable.WebClient.Encryption/DSoft.Portable.WebClient.Encryption.csproj +++ b/DSoft.Portable.WebClient.Encryption/DSoft.Portable.WebClient.Encryption.csproj @@ -1,23 +1,12 @@ - true - true - newky2k newky2k - MIT Encrypted payload communications classes for the DSoft.Portable.WebClient - https://github.com/newky2k/PortableWebClient - https://github.com/newky2k/PortableWebClient - git Web Client - v3.1 - Release - - true - DSoft.snk + v5.2 - Add .NET 10 Support, removed .NET 8.0 false - Copyright © 2021 DSoft - README.md + README.md From 1295c938d64f705f622bfb5ff63311eb3cc06e22 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 25 Sep 2026 18:15:54 +0000 Subject: [PATCH 3/6] Publish packages to nuget.org from GitHub Actions Add a publish job to the release workflow that pushes the built packages to nuget.org using NuGet Trusted Publishing (OIDC) on every push to master, or on demand via workflow_dispatch. Runs in the 'nuget' environment so approvals can be required. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01YZQGUHTkBDHX7av2o9Uqf5 --- .github/workflows/release.yml | 55 ++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 41b04c9..15b9af3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,14 @@ -# Build, test and package on pushes to master -# (replaces azure-pipelines-release.yml) +# Build, test, package and publish to nuget.org on pushes to master +# (replaces the Azure DevOps build and release pipelines) +# +# Publishing uses NuGet Trusted Publishing (OIDC), so no API key is stored in GitHub. +# One-time setup: +# 1. nuget.org > Trusted Publishing: add a GitHub Actions policy for +# owner newky2k, repository PortableWebClient, workflow file release.yml, environment nuget +# 2. GitHub > Settings > Environments: create an environment named "nuget" +# (optionally add required reviewers to approve each publish) +# 3. GitHub > Settings > Secrets and variables > Actions: add a secret NUGET_USER +# containing your nuget.org user name (profile name, not email) name: Release on: @@ -11,9 +20,9 @@ on: workflow_dispatch: inputs: publish: - description: 'Push the packages to nuget.org (requires the NUGET_API_KEY secret)' + description: 'Publish the packages to nuget.org' type: boolean - default: false + default: true env: DOTNET_NOLOGO: true @@ -89,11 +98,35 @@ jobs: name: drop path: artifacts/* + publish: + needs: release + if: ${{ github.event_name == 'push' || inputs.publish }} + runs-on: ubuntu-latest + environment: nuget + permissions: + id-token: write # required for NuGet trusted publishing + + steps: + - name: Download packages + uses: actions/download-artifact@v4 + with: + name: drop + path: artifacts + + - name: Install .NET SDK + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 10.0.x + + - name: NuGet login (OIDC) + id: login + uses: NuGet/login@v1 + with: + user: ${{ secrets.NUGET_USER }} + - name: Push to nuget.org - if: ${{ github.event_name == 'workflow_dispatch' && inputs.publish }} - shell: pwsh - env: - NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} - run: | - if (-not $env:NUGET_API_KEY) { throw 'NUGET_API_KEY secret is not set' } - dotnet nuget push "artifacts/*.nupkg" --api-key $env:NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate + run: > + dotnet nuget push "artifacts/*.nupkg" + --api-key ${{ steps.login.outputs.NUGET_API_KEY }} + --source https://api.nuget.org/v3/index.json + --skip-duplicate From 336247a6b5e4a20d118545ec1c323ce7b72f8a40 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 25 Sep 2026 18:17:39 +0000 Subject: [PATCH 4/6] Allow stable (non-prerelease) releases from the release workflow Pushes to master still produce -prerelease versions; a manual run with 'stable' ticked builds and publishes without the suffix. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01YZQGUHTkBDHX7av2o9Uqf5 --- .github/workflows/release.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 15b9af3..810cce3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,6 +19,10 @@ on: - '.github/workflows/build.yml' workflow_dispatch: inputs: + stable: + description: 'Stable release (no -prerelease suffix). Leave unticked for a beta.' + type: boolean + default: false publish: description: 'Publish the packages to nuget.org' type: boolean @@ -30,7 +34,8 @@ env: SOLUTION: DSoft.Portable.WebClient.slnx BUILD_CONFIGURATION: Release MAJOR_MINOR: '7.0' - RELEASE_SUFFIX: '-prerelease' + # pushes to master are always betas; a manual run with "stable" ticked drops the suffix + RELEASE_SUFFIX: ${{ !inputs.stable && '-prerelease' || '' }} concurrency: group: release From ac79cbc89a9364626abeb0dfdc4ed06cc1385286 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 25 Sep 2026 18:19:08 +0000 Subject: [PATCH 5/6] Control prerelease suffix via RELEASE_SUFFIX in the release workflow Remove the 'stable' manual input; every merge to master publishes, and the suffix is set by editing RELEASE_SUFFIX ('-prerelease' for betas, '' for stable releases). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01YZQGUHTkBDHX7av2o9Uqf5 --- .github/workflows/release.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 810cce3..b971935 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,10 +19,6 @@ on: - '.github/workflows/build.yml' workflow_dispatch: inputs: - stable: - description: 'Stable release (no -prerelease suffix). Leave unticked for a beta.' - type: boolean - default: false publish: description: 'Publish the packages to nuget.org' type: boolean @@ -34,8 +30,8 @@ env: SOLUTION: DSoft.Portable.WebClient.slnx BUILD_CONFIGURATION: Release MAJOR_MINOR: '7.0' - # pushes to master are always betas; a manual run with "stable" ticked drops the suffix - RELEASE_SUFFIX: ${{ !inputs.stable && '-prerelease' || '' }} + # set to '-prerelease' while working on a beta, or '' for a stable release + RELEASE_SUFFIX: '-prerelease' concurrency: group: release From 25b3db2c65d904e03fb747a33c99fc48df37ada1 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 25 Sep 2026 18:30:59 +0000 Subject: [PATCH 6/6] Tag and create a GitHub release after publishing to nuget.org New 'tag' job runs once the publish succeeds: tags the built commit as v{version}, creates a GitHub release with generated notes and the .nupkg files attached, marked as prerelease when RELEASE_SUFFIX is set. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01YZQGUHTkBDHX7av2o9Uqf5 --- .github/workflows/release.yml | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b971935..8f2c1d9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -# Build, test, package and publish to nuget.org on pushes to master +# Build, test, package, publish to nuget.org and tag the release on pushes to master # (replaces the Azure DevOps build and release pipelines) # # Publishing uses NuGet Trusted Publishing (OIDC), so no API key is stored in GitHub. @@ -45,6 +45,8 @@ jobs: release: # windows is required for the WPF TestHarness (net10.0-windows) and the net462 targets runs-on: windows-latest + outputs: + version: ${{ steps.version.outputs.version }}${{ env.RELEASE_SUFFIX }} steps: - uses: actions/checkout@v5 @@ -131,3 +133,32 @@ jobs: --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate + + tag: + # tag the commit and create a GitHub release once the packages are on nuget.org + needs: [ release, publish ] + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Download packages + uses: actions/download-artifact@v4 + with: + name: drop + path: artifacts + + - name: Create tag and GitHub release + env: + GH_TOKEN: ${{ github.token }} + TAG: v${{ needs.release.outputs.version }} + PRERELEASE: ${{ env.RELEASE_SUFFIX != '' }} + run: | + flags=() + if [ "$PRERELEASE" = "true" ]; then flags+=(--prerelease); else flags+=(--latest); fi + gh release create "$TAG" artifacts/*.nupkg \ + --repo "$GITHUB_REPOSITORY" \ + --target "$GITHUB_SHA" \ + --title "$TAG" \ + --generate-notes \ + "${flags[@]}"