Compare commits

..
1 Commits
Author SHA1 Message Date
xrain cbfafe32c2 fix ci 2020-11-11 12:54:17 +08:00
3 changed files with 17 additions and 16 deletions
+14 -1
View File
@@ -3,7 +3,20 @@ name: PublishNugetPackage
on: [create] on: [create]
jobs: jobs:
build:
name: Build Project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.100'
- name: Build
run: dotnet build
publish: publish:
needs: build
name: Publish Project to Nuget name: Publish Project to Nuget
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@@ -15,7 +28,7 @@ jobs:
- name: Publish - name: Publish
run: | run: |
version=`git describe --tags` version=`git describe --tags`
dotnet build --configuration release -p:PackageVersion=$version dotnet pack --configuration release -p:PackageVersion=$version
dotnet nuget push bin/release/Simcu.SimApi.$version.nupkg -k ${NUGET_APIKEY} -s https://www.nuget.org/api/v2/package dotnet nuget push bin/release/Simcu.SimApi.$version.nupkg -k ${NUGET_APIKEY} -s https://www.nuget.org/api/v2/package
env: env:
NUGET_APIKEY: ${{ secrets.NUGET_APIKEY }} NUGET_APIKEY: ${{ secrets.NUGET_APIKEY }}
+1 -3
View File
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp5.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<PackOnBuild>true</PackOnBuild> <PackOnBuild>true</PackOnBuild>
<Version>0.2.3</Version> <Version>0.2.3</Version>
@@ -13,8 +13,6 @@
<IncludeSymbols>true</IncludeSymbols> <IncludeSymbols>true</IncludeSymbols>
<ReleaseVersion>5.0.0</ReleaseVersion> <ReleaseVersion>5.0.0</ReleaseVersion>
<SynchReleaseVersion>false</SynchReleaseVersion> <SynchReleaseVersion>false</SynchReleaseVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageVersion>5.0.2</PackageVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(RunConfiguration)' == 'YYApi' " /> <PropertyGroup Condition=" '$(RunConfiguration)' == 'YYApi' " />
+2 -12
View File
@@ -5,7 +5,6 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerUI; using Swashbuckle.AspNetCore.SwaggerUI;
using SimApi.Middlewares; using SimApi.Middlewares;
using Microsoft.AspNetCore.HttpOverrides;
namespace SimApi namespace SimApi
{ {
@@ -29,16 +28,7 @@ namespace SimApi
public static IServiceCollection AddSimApi(this IServiceCollection builder, string title, public static IServiceCollection AddSimApi(this IServiceCollection builder, string title,
string description = null) string description = null)
{ {
return builder.AddSimApiAuth().AddSimApiDoc(title, description).AddCors().AddSimApiUpload().Configure<ForwardedHeadersOptions>(options => return builder.AddSimApiAuth().AddSimApiDoc(title, description).AddCors().AddSimApiUpload();
{
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor |
ForwardedHeaders.XForwardedProto;
// Only loopback proxies are allowed by default.
// Clear that restriction because forwarders are enabled by explicit
// configuration.
options.KnownNetworks.Clear();
options.KnownProxies.Clear();
}); ;
} }
/// <summary> /// <summary>
@@ -51,7 +41,7 @@ namespace SimApi
/// <returns></returns> /// <returns></returns>
public static IApplicationBuilder UseSimApi(this IApplicationBuilder builder, params SubmitMethod[] submitMethods) public static IApplicationBuilder UseSimApi(this IApplicationBuilder builder, params SubmitMethod[] submitMethods)
{ {
return builder.UseSimApiException().UseSimApiDoc(submitMethods).UseMiddleware<SimApiAuthMiddleware>().UseCors(x => x.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin()).UseSimApiUpload().UseForwardedHeaders(); return builder.UseSimApiException().UseSimApiDoc(submitMethods).UseMiddleware<SimApiAuthMiddleware>().UseCors(x => x.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin()).UseSimApiUpload();
} }