From 73483bf213e28b0487367db133138893490a3ec2 Mon Sep 17 00:00:00 2001 From: David Humphreys Date: Fri, 9 Oct 2026 20:00:55 +0100 Subject: [PATCH 1/3] Move CI and release to GitHub Actions Replaces the two Azure Pipelines definitions with the workflows the other DSoft libraries use. ci.yml builds Release for every target framework on pull requests to master and development. release.yml runs on every push to master: builds Release as 4.0.yyMM., uploads the package as the drop artifact, pushes it to nuget.org with Trusted Publishing, and tags the commit and creates a GitHub release. AssemblyVersion is still not stamped by CI; it stays pinned in the project file for the reason recorded there. ContinuousIntegrationBuild now also switches on under GITHUB_ACTIONS so Source Link keeps emitting. Co-Authored-By: Claude Fable 5.1 --- .github/workflows/ci.yml | 34 ++++++ .github/workflows/release.yml | 101 ++++++++++++++++++ DSoft.System.BluetoothLe.slnx | 4 +- .../DSoft.System.BluetoothLe.csproj | 2 +- README.md | 7 ++ azure-pipelines-mergetest.yml | 54 ---------- azure-pipelines-release.yml | 80 -------------- 7 files changed, 145 insertions(+), 137 deletions(-) create mode 100644 .github/workflows/ci.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/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..65feb6c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +# Pull request validation: builds Release for every target framework. Publishes nothing. +# There is no unit test project; WpfSample is a manual sample and is built with the solution. +name: CI + +on: + pull_request: + branches: [master, development] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: windows-latest + steps: + - uses: actions/checkout@v7 + + - uses: actions/setup-dotnet@v6 + with: + dotnet-version: '10.x' + + - name: Restore workloads + run: dotnet workload restore DSoft.System.BluetoothLe/DSoft.System.BluetoothLe.csproj + + - name: Restore + run: dotnet restore DSoft.System.BluetoothLe.slnx + + - name: Build + run: dotnet build DSoft.System.BluetoothLe.slnx --configuration Release --no-restore diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c497498 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,101 @@ +# Release: on every push to master, builds Release and pushes the DSoft.*.nupkg +# package (with its .snupkg symbols) to nuget.org as 4.0.yyMM., then +# tags the commit and creates a GitHub release with the package attached. +# RELEASE_SUFFIX is empty for a stable version; set it to a suffix such as +# '-prerelease' to publish a prerelease. +# Signs in to nuget.org with Trusted Publishing (OIDC), so no API key is stored. +name: Release + +on: + push: + branches: [master] + paths-ignore: + - '**.md' + - '.github/workflows/**' + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: release + cancel-in-progress: false + +env: + RELEASE_SUFFIX: '' + +jobs: + release: + runs-on: windows-latest + environment: nuget + permissions: + contents: write # GitHub release and tag + id-token: write # Trusted Publishing + steps: + - uses: actions/checkout@v7 + + - uses: actions/setup-dotnet@v6 + with: + dotnet-version: '10.x' + + - name: Version + id: version + shell: bash + run: | + version="4.0.$(date -u +%y%m).${{ github.run_number }}" + echo "version=$version" >> "$GITHUB_OUTPUT" + echo "package=$version$RELEASE_SUFFIX" >> "$GITHUB_OUTPUT" + echo "Version: $version$RELEASE_SUFFIX" + + - name: Restore workloads + run: dotnet workload restore DSoft.System.BluetoothLe/DSoft.System.BluetoothLe.csproj + + - name: Restore + run: dotnet restore DSoft.System.BluetoothLe.slnx + + # AssemblyVersion is deliberately not overridden. It is pinned in the csproj, because a strong-named + # assembly whose identity moves on every CI build forces consumers on net481 to carry a binding + # redirect. FileVersion still carries the build number, which is what a support engineer reads off + # a shipped file. + - name: Build + run: > + dotnet build DSoft.System.BluetoothLe.slnx --configuration Release --no-restore + /p:Version=${{ steps.version.outputs.package }} + /p:FileVersion=${{ steps.version.outputs.version }} + + - name: Collect packages + shell: bash + run: | + mkdir -p artifacts + find DSoft.System.BluetoothLe -path '*/bin/Release/*' \( -name 'DSoft.*.nupkg' -o -name 'DSoft.*.snupkg' \) -exec cp {} artifacts/ \; + ls artifacts + + - uses: actions/upload-artifact@v7 + with: + name: drop + path: artifacts/* + + - name: NuGet login + id: nuget + uses: NuGet/login@v1 + with: + user: ${{ secrets.NUGET_USER }} + + # The .snupkg next to each .nupkg is pushed with it. + - name: Push to nuget.org + shell: bash + run: | + for package in artifacts/*.nupkg; do + dotnet nuget push "$package" --api-key "${{ steps.nuget.outputs.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate + done + + - name: GitHub release + shell: bash + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release create "v${{ steps.version.outputs.package }}" artifacts/*.nupkg \ + --target "${{ github.sha }}" \ + --title "${{ steps.version.outputs.package }}" \ + --generate-notes \ + ${RELEASE_SUFFIX:+--prerelease} diff --git a/DSoft.System.BluetoothLe.slnx b/DSoft.System.BluetoothLe.slnx index 4143f79..5ba5d22 100644 --- a/DSoft.System.BluetoothLe.slnx +++ b/DSoft.System.BluetoothLe.slnx @@ -13,8 +13,8 @@ - - + + diff --git a/DSoft.System.BluetoothLe/DSoft.System.BluetoothLe.csproj b/DSoft.System.BluetoothLe/DSoft.System.BluetoothLe.csproj index 5f7b45e..aae1ef9 100644 --- a/DSoft.System.BluetoothLe/DSoft.System.BluetoothLe.csproj +++ b/DSoft.System.BluetoothLe/DSoft.System.BluetoothLe.csproj @@ -125,7 +125,7 @@ true true snupkg - true + true diff --git a/README.md b/README.md index 7facadd..bdbe61c 100644 --- a/README.md +++ b/README.md @@ -243,6 +243,13 @@ dotnet build DSoft.System.BluetoothLe.slnx --no-restore `net10.0-windows10.0.19041.0` and `net481` are only built when the host is Windows; on macOS and Linux the remaining seven target frameworks build and the two Windows ones are skipped. +### Continuous integration + +GitHub Actions (`.github/workflows/`): + +- `ci.yml`: runs on pull requests to `master` and `development`. Builds Release for every target framework. Publishes nothing. +- `release.yml`: runs on every push to `master` (changes only to Markdown or workflow files are skipped; run it by hand to test a workflow change). Builds Release as `4.0.yyMM.` plus `RELEASE_SUFFIX` (empty for a stable version; set it to `-prerelease` in the workflow to publish a prerelease), uploads the package as the `drop` artifact and pushes it to nuget.org with Trusted Publishing (OIDC, `NUGET_USER` secret, `nuget` environment), then tags the commit `v` and creates a GitHub release with the package attached. `AssemblyVersion` is not stamped by CI: it stays pinned in the project file (see "Strong naming"). + ### Strong naming The assembly is strong-named with `DSoft.snk`, which is committed to this repository on purpose. A strong diff --git a/azure-pipelines-mergetest.yml b/azure-pipelines-mergetest.yml deleted file mode 100644 index bc56863..0000000 --- a/azure-pipelines-mergetest.yml +++ /dev/null @@ -1,54 +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: -- name: solution - value: '**/*.slnx' -- name: buildPlatform - value: 'Any CPU' -- name: buildConfiguration - value: 'Release' -- name: NUGET.PLUGIN.HANDSHAKE.TIMEOUT.IN.SECONDS - value: 60 -- name: NUGET.PLUGIN.REQUEST.TIMEOUT.IN.SECONDS - value: 60 -- name: netVersion - value: '10.x' - -steps: - -- task: NuGetToolInstaller@1 - displayName: Install Latest Nuget - -- task: UseDotNet@2 - displayName: 'Install .NET sdk' - inputs: - packageType: 'sdk' - version: $(netVersion) - -- task: Bash@3 - displayName: Restore Workloads - inputs: - targetType: 'inline' - script: - dotnet workload restore - -- task: DotNetCoreCLI@2 - displayName: dotnet restore - 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 85b6525..0000000 --- a/azure-pipelines-release.yml +++ /dev/null @@ -1,80 +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 -pool: - vmImage: 'windows-latest' - -variables: -- name: solution - value: '**/*.slnx' -- name: buildPlatform - value: 'Any CPU' -- name: buildConfiguration - value: 'Release' -- name: NUGET.PLUGIN.HANDSHAKE.TIMEOUT.IN.SECONDS - value: 60 -- name: NUGET.PLUGIN.REQUEST.TIMEOUT.IN.SECONDS - value: 60 -- name: netVersion - value: '10.x' -- name: releaseSuffix - value: '' - -name: 4.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: Bash@3 - displayName: Restore Workloads - inputs: - targetType: 'inline' - script: - dotnet workload restore - -- task: DotNetCoreCLI@2 - displayName: dotnet restore - inputs: - command: 'restore' - projects: '$(solution)' - -- task: DotNetCoreCLI@2 - displayName: dotnet build - inputs: - command: 'build' - projects: '$(solution)' - # AssemblyVersion is deliberately not overridden here. It is pinned in the csproj, because a strong-named - # assembly whose identity moves on every CI build forces consumers on net481 to carry a binding redirect. - # FileVersion still carries the build number, which is what a support engineer reads off a shipped file. - arguments: '--configuration $(buildConfiguration) --no-restore /p:Platform="$(buildPlatform)" /p:Version=$(Build.BuildNumber)$(ReleaseSuffix) /p:FileVersion=$(Build.BuildNumber)' - -- task: CopyFiles@2 - displayName: Copy Files to $(build.artifactstagingdirectory) - inputs: - SourceFolder: '$(system.defaultworkingdirectory)' - Contents: | - **/DSoft.*.nupkg - **/DSoft.*.snupkg - TargetFolder: '$(build.artifactstagingdirectory)' - flattenFolders: true - -- task: PublishBuildArtifacts@1 - displayName: Publish Artifacts drop - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)' - ArtifactName: 'drop' - publishLocation: 'Container' From 9d8e44f112fd49c7aec0f189e1ad48c956ef4f29 Mon Sep 17 00:00:00 2001 From: David Humphreys Date: Wed, 14 Oct 2026 21:53:05 +0100 Subject: [PATCH 2/3] Point the release and CI workflows at main The repository's default branch is now main. Release runs on pushes to main and CI validates pull requests into main and development. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 4 ++-- README.md | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 65feb6c..dcfce53 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,7 @@ name: CI on: pull_request: - branches: [master, development] + branches: [main, development] workflow_dispatch: permissions: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c497498..62b733c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -# Release: on every push to master, builds Release and pushes the DSoft.*.nupkg +# Release: on every push to main, builds Release and pushes the DSoft.*.nupkg # package (with its .snupkg symbols) to nuget.org as 4.0.yyMM., then # tags the commit and creates a GitHub release with the package attached. # RELEASE_SUFFIX is empty for a stable version; set it to a suffix such as @@ -8,7 +8,7 @@ name: Release on: push: - branches: [master] + branches: [main] paths-ignore: - '**.md' - '.github/workflows/**' diff --git a/README.md b/README.md index bdbe61c..0fca7bf 100644 --- a/README.md +++ b/README.md @@ -247,8 +247,8 @@ remaining seven target frameworks build and the two Windows ones are skipped. GitHub Actions (`.github/workflows/`): -- `ci.yml`: runs on pull requests to `master` and `development`. Builds Release for every target framework. Publishes nothing. -- `release.yml`: runs on every push to `master` (changes only to Markdown or workflow files are skipped; run it by hand to test a workflow change). Builds Release as `4.0.yyMM.` plus `RELEASE_SUFFIX` (empty for a stable version; set it to `-prerelease` in the workflow to publish a prerelease), uploads the package as the `drop` artifact and pushes it to nuget.org with Trusted Publishing (OIDC, `NUGET_USER` secret, `nuget` environment), then tags the commit `v` and creates a GitHub release with the package attached. `AssemblyVersion` is not stamped by CI: it stays pinned in the project file (see "Strong naming"). +- `ci.yml`: runs on pull requests to `main` and `development`. Builds Release for every target framework. Publishes nothing. +- `release.yml`: runs on every push to `main` (changes only to Markdown or workflow files are skipped; run it by hand to test a workflow change). Builds Release as `4.0.yyMM.` plus `RELEASE_SUFFIX` (empty for a stable version; set it to `-prerelease` in the workflow to publish a prerelease), uploads the package as the `drop` artifact and pushes it to nuget.org with Trusted Publishing (OIDC, `NUGET_USER` secret, `nuget` environment), then tags the commit `v` and creates a GitHub release with the package attached. `AssemblyVersion` is not stamped by CI: it stays pinned in the project file (see "Strong naming"). ### Strong naming From 13ec2971ffb97ac926cf7311bbce4fc02fde5347 Mon Sep 17 00:00:00 2001 From: David Humphreys Date: Wed, 14 Oct 2026 22:03:48 +0100 Subject: [PATCH 3/3] Offset the release run number and drop the last Azure Pipelines reference GitHub's run number never resets, so the first release from main this month would publish 4.0.2610.1, sorting below 4.0.2610.91 that Azure Pipelines published. Adding 100 makes the first release 4.0.2610.101 and keeps every later one above it. ContinuousIntegrationBuild no longer checks TF_BUILD now that the Azure Pipelines definitions are gone. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 7 +++++-- DSoft.System.BluetoothLe/DSoft.System.BluetoothLe.csproj | 2 +- README.md | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 62b733c..5dd5fe9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,5 @@ # Release: on every push to main, builds Release and pushes the DSoft.*.nupkg -# package (with its .snupkg symbols) to nuget.org as 4.0.yyMM., then +# package (with its .snupkg symbols) to nuget.org as 4.0.yyMM., then # tags the commit and creates a GitHub release with the package attached. # RELEASE_SUFFIX is empty for a stable version; set it to a suffix such as # '-prerelease' to publish a prerelease. @@ -42,7 +42,10 @@ jobs: id: version shell: bash run: | - version="4.0.$(date -u +%y%m).${{ github.run_number }}" + # The run number is offset by 100 so the first GitHub release sorts above 4.0.2610.91, the + # last version Azure Pipelines published. The run number never resets, so the offset is + # permanent and harmless. + version="4.0.$(date -u +%y%m).$(( ${{ github.run_number }} + 100 ))" echo "version=$version" >> "$GITHUB_OUTPUT" echo "package=$version$RELEASE_SUFFIX" >> "$GITHUB_OUTPUT" echo "Version: $version$RELEASE_SUFFIX" diff --git a/DSoft.System.BluetoothLe/DSoft.System.BluetoothLe.csproj b/DSoft.System.BluetoothLe/DSoft.System.BluetoothLe.csproj index aae1ef9..b101dab 100644 --- a/DSoft.System.BluetoothLe/DSoft.System.BluetoothLe.csproj +++ b/DSoft.System.BluetoothLe/DSoft.System.BluetoothLe.csproj @@ -125,7 +125,7 @@ true true snupkg - true + true diff --git a/README.md b/README.md index 0fca7bf..05071ea 100644 --- a/README.md +++ b/README.md @@ -248,7 +248,7 @@ remaining seven target frameworks build and the two Windows ones are skipped. GitHub Actions (`.github/workflows/`): - `ci.yml`: runs on pull requests to `main` and `development`. Builds Release for every target framework. Publishes nothing. -- `release.yml`: runs on every push to `main` (changes only to Markdown or workflow files are skipped; run it by hand to test a workflow change). Builds Release as `4.0.yyMM.` plus `RELEASE_SUFFIX` (empty for a stable version; set it to `-prerelease` in the workflow to publish a prerelease), uploads the package as the `drop` artifact and pushes it to nuget.org with Trusted Publishing (OIDC, `NUGET_USER` secret, `nuget` environment), then tags the commit `v` and creates a GitHub release with the package attached. `AssemblyVersion` is not stamped by CI: it stays pinned in the project file (see "Strong naming"). +- `release.yml`: runs on every push to `main` (changes only to Markdown or workflow files are skipped; run it by hand to test a workflow change). Builds Release as `4.0.yyMM.` plus `RELEASE_SUFFIX` (empty for a stable version; set it to `-prerelease` in the workflow to publish a prerelease), uploads the package as the `drop` artifact and pushes it to nuget.org with Trusted Publishing (OIDC, `NUGET_USER` secret, `nuget` environment), then tags the commit `v` and creates a GitHub release with the package attached. `AssemblyVersion` is not stamped by CI: it stays pinned in the project file (see "Strong naming"). ### Strong naming