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
39 changes: 39 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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 }}
164 changes: 164 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# 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.
# 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:
push:
branches: [ master ]
paths-ignore:
- '**.md'
- '.github/workflows/build.yml'
workflow_dispatch:
inputs:
publish:
description: 'Publish the packages to nuget.org'
type: boolean
default: true

env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
SOLUTION: DSoft.Portable.WebClient.slnx
BUILD_CONFIGURATION: Release
MAJOR_MINOR: '7.0'
# set to '-prerelease' while working on a beta, or '' for a stable release
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
outputs:
version: ${{ steps.version.outputs.version }}${{ env.RELEASE_SUFFIX }}

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/*

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
run: >
dotnet nuget push "artifacts/*.nupkg"
--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[@]}"
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Authors>newky2k</Authors>
<Company>newky2k</Company>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Description>Encrypted payload communications classes for the DSoft.Portable.WebClient</Description>
<PackageProjectUrl>https://github.com/newky2k/PortableWebClient</PackageProjectUrl>
<RepositoryUrl>https://github.com/newky2k/PortableWebClient</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>Web Client</PackageTags>
<PackageReleaseNotes>v3.1 - Release
</PackageReleaseNotes>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>DSoft.snk</AssemblyOriginatorKeyFile>
<PackageReleaseNotes>v5.2 - Add .NET 10 Support, removed .NET 8.0</PackageReleaseNotes>
<DelaySign>false</DelaySign>
<Copyright>Copyright © 2021 DSoft</Copyright>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

<ItemGroup>
Expand All @@ -28,8 +17,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.9" />
<PackageReference Include="System.Text.Json" Version="10.0.9" />
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.12" />
<PackageReference Include="System.Text.Json" Version="10.0.12" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.35.1" />
<PackageReference Include="Google.Protobuf" Version="3.36.2" />
<PackageReference Include="Grpc.Core" Version="2.46.6" />
<PackageReference Include="Grpc.Tools" Version="2.81.1">
<PackageReference Include="Grpc.Tools" Version="2.84.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.9" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.12" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Grpc.Net.Client" Version="2.80.0" />
<PackageReference Include="Grpc.Net.Client.Web" Version="2.80.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.9" />
<PackageReference Include="Grpc.Net.Client" Version="2.84.0" />
<PackageReference Include="Grpc.Net.Client.Web" Version="2.84.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.12" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
<PackageReference Include="System.Text.Json" Version="10.0.9" />
<PackageReference Include="System.Text.Json" Version="10.0.12" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http" Version="10.0.9" />
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.9" />
<PackageReference Include="Microsoft.Extensions.Http" Version="10.0.12" />
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.12" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions DSoft.Portable.WebClient.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
</Folder>
<Folder Name="/_ci/">
<File Path=".editorconfig" />
<File Path="azure-pipelines-mergetest.yml" />
<File Path="azure-pipelines-release.yml" />
<File Path=".github/workflows/build.yml" />
<File Path=".github/workflows/release.yml" />
<File Path="CLAUDE.md" />
<File Path="Directory.Build.props" />
<File Path="README.md" />
Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
</PropertyGroup>

<ItemGroup Condition=" '$(Configuration)'=='Release'">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.401" PrivateAssets="All" />
</ItemGroup>

<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">
<PropertyGroup Condition="'$(TF_BUILD)' == 'true' Or '$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)



Expand Down
6 changes: 3 additions & 3 deletions RpcSample/RpcSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

<ItemGroup>

<PackageReference Include="Google.Protobuf" Version="3.35.1" />
<PackageReference Include="Google.Protobuf" Version="3.36.2" />
<PackageReference Include="Grpc.Core" Version="2.46.6" />
<PackageReference Include="Grpc.Core.Api" Version="2.80.0" />
<PackageReference Include="Grpc.Tools" Version="2.81.1">
<PackageReference Include="Grpc.Core.Api" Version="2.84.0" />
<PackageReference Include="Grpc.Tools" Version="2.84.0">

<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
2 changes: 1 addition & 1 deletion SampleApiClient/SampleApiClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.9" />
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.12" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions SampleWebApp/SampleWebApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="10.0.2" />
<PackageReference Include="Grpc.AspNetCore" Version="2.80.0" />
<PackageReference Include="Grpc.AspNetCore.Web" Version="2.80.0" />
<PackageReference Include="NuGet.Packaging" Version="7.6.0" />
<PackageReference Include="NuGet.Protocol" Version="7.6.0" />
<PackageReference Include="Grpc.AspNetCore" Version="2.84.0" />
<PackageReference Include="Grpc.AspNetCore.Web" Version="2.84.0" />
<PackageReference Include="NuGet.Packaging" Version="7.9.0" />
<PackageReference Include="NuGet.Protocol" Version="7.9.0" />

</ItemGroup>

Expand Down
12 changes: 6 additions & 6 deletions UnitTester/UnitTester.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.9" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.6.0" />
<PackageReference Include="MSTest.TestAdapter" Version="4.2.3" />
<PackageReference Include="MSTest.TestFramework" Version="4.2.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.12" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.10.1" />
<PackageReference Include="MSTest.TestAdapter" Version="4.4.1" />
<PackageReference Include="MSTest.TestFramework" Version="4.4.1" />
<PackageReference Include="coverlet.collector" Version="10.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NuGet.Packaging" Version="7.6.0" />
<PackageReference Include="NuGet.Protocol" Version="7.6.0" />
<PackageReference Include="NuGet.Packaging" Version="7.9.0" />
<PackageReference Include="NuGet.Protocol" Version="7.9.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading