-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from BenjaminAbt/feature/updates
add updates
- Loading branch information
Showing
30 changed files
with
228 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,63 @@ | ||
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 | ||
|
||
- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,32 @@ | ||
// Copyright © Benjamin Abt 2020-2021, all rights reserved | ||
|
||
using Microsoft.AspNetCore.Hosting; | ||
using Microsoft.Extensions.Hosting; | ||
// Copyright © Benjamin Abt 2020-2024, all rights reserved | ||
|
||
namespace BenjaminAbt.HCaptcha.Samples.AspNetCore; | ||
|
||
/// <summary> | ||
/// The entry point for the application, responsible for setting up and running the web host. | ||
/// </summary> | ||
public class Program | ||
{ | ||
/// <summary> | ||
/// The main entry point for the application. | ||
/// </summary> | ||
/// <param name="args">The command-line arguments passed to the application.</param> | ||
public static void Main(string[] args) | ||
{ | ||
// Build and run the host | ||
CreateHostBuilder(args).Build().Run(); | ||
} | ||
|
||
/// <summary> | ||
/// Creates and configures the <see cref="IHostBuilder"/> for the application. | ||
/// </summary> | ||
/// <param name="args">The command-line arguments passed to the application.</param> | ||
/// <returns>An <see cref="IHostBuilder"/> that configures the web host.</returns> | ||
public static IHostBuilder CreateHostBuilder(string[] args) => | ||
Host.CreateDefaultBuilder(args) | ||
.ConfigureWebHostDefaults(webBuilder => | ||
{ | ||
// Use the Startup class for configuring services and middleware | ||
webBuilder.UseStartup<Startup>(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,38 @@ | ||
// Copyright © Benjamin Abt 2020-2021, all rights reserved | ||
// Copyright © Benjamin Abt 2020-2024, all rights reserved | ||
|
||
using System; | ||
using Microsoft.AspNetCore.Mvc.ModelBinding; | ||
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders; | ||
|
||
namespace BenjaminAbt.HCaptcha.AspNetCore; | ||
|
||
/// <summary> | ||
/// Provides a model binder for binding an <see cref="HCaptchaVerifyResponse"/> to an action parameter. | ||
/// </summary> | ||
public class AuthorEntityBinderProvider : IModelBinderProvider | ||
{ | ||
/// <summary> | ||
/// Returns a model binder for the <see cref="HCaptchaVerifyResponse"/> model type, if applicable. | ||
/// </summary> | ||
/// <param name="context">The context that provides information about the model being bound.</param> | ||
/// <returns> | ||
/// An <see cref="IModelBinder"/> instance if the model type is <see cref="HCaptchaVerifyResponse"/>, otherwise <c>null</c>. | ||
/// </returns> | ||
/// <exception cref="ArgumentNullException"> | ||
/// Thrown when the <paramref name="context"/> is <c>null</c>. | ||
/// </exception> | ||
public IModelBinder? GetBinder(ModelBinderProviderContext context) | ||
{ | ||
// Ensure the context is not null | ||
ArgumentNullException.ThrowIfNull(context); | ||
|
||
// Check if the model type is HCaptchaVerifyResponse | ||
if (context.Metadata.ModelType == typeof(HCaptchaVerifyResponse)) | ||
{ | ||
// Return a binder for HCaptchaVerifyResponse | ||
return new BinderTypeModelBinder(typeof(HCaptchaModelBinder)); | ||
} | ||
|
||
// Return null if no binder is required for the model type | ||
return null; | ||
} | ||
} |
Oops, something went wrong.