Skip to content

Commit

Permalink
add updates
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminAbt committed Nov 13, 2024
1 parent abfc287 commit 821bb18
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 39 deletions.
43 changes: 30 additions & 13 deletions .github/workflows/ci.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,78 @@
name: NETCore
name: NET

on:
push:
branches:
- main
pull_request:
types: [labeled]
branches:
- main


env:
BuildConfig: Release
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_VERSION: '6.0.101' # https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/6.0/releases.json

jobs:
build:
runs-on: ubuntu-latest
steps:

- name: Cancel previous builds in PR
uses: styfle/cancel-workflow-action@0.9.1
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}

- name: Checkout
uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.

- name: 'Install .NET SDK'
uses: actions/setup-dotnet@v1
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
global-json-file: ./global.json

- name: Restore dependencies
run: dotnet restore

- name: Versioning
- name: Setup Git Versioning
uses: dotnet/nbgv@master
id: nbgv

- name: Version Info
- name: Show Version Info
run: |
echo 'SemVer2: ${{ steps.nbgv.outputs.SemVer2 }}'
- name: Build with dotnet
run: dotnet build
--configuration ${{ env.BuildConfig }}
--no-restore --configuration ${{ env.BuildConfig }}
/p:Version=${{ steps.nbgv.outputs.AssemblyVersion }}

- name: Test with dotnet
run: dotnet test
--no-build --configuration ${{ env.BuildConfig }}
--logger "trx;LogFileName=test-results.trx" --results-directory ./artifacts/testResults
continue-on-error: true

- name: Test Report
uses: dorny/test-reporter@v1
if: always()
with:
name: DotNET Tests
path: "./artifacts/testResults/test-results.trx"
reporter: dotnet-trx
fail-on-error: true

- name: Pack NuGet
run: dotnet pack
--configuration ${{ env.BuildConfig }}
/p:ContinuousIntegrationBuild=true
/p:Version=${{ steps.nbgv.outputs.NuGetPackageVersion }}

- name: Push to NuGet
run: dotnet nuget push **/*.nupkg
--api-key ${{ secrets.NUGET_DEPLOY_KEY }}
--source https://api.nuget.org/v3/index.json
--no-symbols 1
--no-symbols
--skip-duplicate
3 changes: 2 additions & 1 deletion hcaptchanet.sln → BenjaminAbt.HCaptchaNET.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_", "_", "{246E4F1E-C4B3-4180-906C-605E72C69097}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.github\workflows\ci.yml = .github\workflows\ci.yml
.github\workflows\build.yml = .github\workflows\build.yml
Directory.Build.props = Directory.Build.props
Directory.Packages.props = Directory.Packages.props
global.json = global.json
README.md = README.md
version.json = version.json
Expand Down
Binary file added BenjaminAbt.HCaptchaNET.snk
Binary file not shown.
34 changes: 30 additions & 4 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,45 @@
<PackageProjectUrl>https://github.com/BenjaminAbt/hcaptcha</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<DefaultLanguage>en-US</DefaultLanguage>
<NoPackageAnalysis>true</NoPackageAnalysis>
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<DebugType>embedded</DebugType>
<IsPackable>false</IsPackable>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<PropertyGroup Label="Env">
<IsTestProject>$(MSBuildProjectName.Contains('Test'))</IsTestProject>
<IsBenchmarkProject>$(MsBuildProjectName.Contains('Benchmark'))</IsBenchmarkProject>
<IsPackable>false</IsPackable>
</PropertyGroup>

<PropertyGroup Condition="'$(IsTestProject)' != 'true' AND '$(IsBenchmarkProject)' != 'true'">
<GenerateDocumentationFile Condition="'$(Configuration)' == 'Release'">true</GenerateDocumentationFile>
</PropertyGroup>

<PropertyGroup Label="Project Defaults">
<TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Label="C#">
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)BenjaminAbt.HCaptchaNET.snk</AssemblyOriginatorKeyFile>

<PublicKey>
0024000004800000940000000602000000240000525341310004000001000100a9ba6ecd5a2e4a
a9095322a9baebe05966db4f05bf23df1457fc7b084079d7b320a3b0bcf5bb278d9e66f8f70d7e
3d813aeb6a96baf75ef83033a5e0e5558df774d575599cdafbe6e047522db722b6244860a0d5b3
b3bfbe24c50d698411c5d19e3d3765c9599809e2808ed0d6b2f9129395a95468484eac0815b070
ea5b95dc
</PublicKey>
</PropertyGroup>

</Project>
12 changes: 12 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>

<ItemGroup Label=".NET Dependencies">
<PackageVersion Include="Refit" Version="7.2.22" />
<PackageVersion Include="Refit.HttpClientFactory" Version="7.2.22" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="8.0.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "6.0.101"
"version": "9.0.100"
}
}
Binary file added public.snk
Binary file not shown.
1 change: 0 additions & 1 deletion sample/sample.aspnetcore/sample.aspnetcore.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>BenjaminAbt.HCaptcha.Samples.AspNetCore</AssemblyName>
<RootNamespace>BenjaminAbt.HCaptcha.Samples.AspNetCore</RootNamespace>
</PropertyGroup>
Expand Down
9 changes: 1 addition & 8 deletions src/HCaptcha.AspNetCore/HCaptcha.AspNetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,9 @@

<PropertyGroup>
<Product>HCaptcha for ASP.NET Core</Product>
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>BenjaminAbt.HCaptcha.AspNetCore</AssemblyName>
<RootNamespace>BenjaminAbt.HCaptcha.AspNetCore</RootNamespace>
<GenerateDocumentationFile Condition=" '$(Configuration)' == 'Release' ">true</GenerateDocumentationFile>
<DebugType>embedded</DebugType>
</PropertyGroup>

<PropertyGroup>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<IsPackable>true</IsPackable>
</PropertyGroup>

Expand All @@ -34,7 +27,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Refit.HttpClientFactory" Version="6.1.15" />
<PackageReference Include="Refit.HttpClientFactory" />
</ItemGroup>

<ItemGroup>
Expand Down
13 changes: 3 additions & 10 deletions src/HCaptcha/HCaptcha.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@
<Product>HCaptcha for .NET</Product>
<AssemblyName>BenjaminAbt.HCaptcha</AssemblyName>
<RootNamespace>BenjaminAbt.HCaptcha</RootNamespace>
<TargetFramework>net6.0</TargetFramework>
<GenerateDocumentationFile Condition=" '$(Configuration)' == 'Release' ">true</GenerateDocumentationFile>
<DebugType>embedded</DebugType>
</PropertyGroup>

<PropertyGroup>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<IsPackable>true</IsPackable>
</PropertyGroup>

Expand All @@ -30,9 +23,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Refit" Version="6.1.15" />
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Refit" />
<PackageReference Include="Microsoft.Extensions.Options" />
<PackageReference Include="Microsoft.Extensions.Http" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "0.9",
"version": "1.0",
"assemblyVersion": {
"precision": "revision" // optional. Use when you want a more precise assembly version than the default major.minor.
},
Expand Down

0 comments on commit 821bb18

Please sign in to comment.