mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -07:00
More build versioning changes #865
This commit is contained in:
parent
302f7ca285
commit
2535645a90
6 changed files with 36 additions and 26 deletions
13
build.cake
13
build.cake
|
@ -58,7 +58,7 @@ Task("Clean")
|
||||||
.Does(() =>
|
.Does(() =>
|
||||||
{
|
{
|
||||||
CleanDirectory(buildDir);
|
CleanDirectory(buildDir);
|
||||||
CleanDirectory(nodeModulesDir);
|
//CleanDirectory(nodeModulesDir);
|
||||||
CleanDirectory(wwwRootDistDir);
|
CleanDirectory(wwwRootDistDir);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -80,8 +80,15 @@ Task("SetVersionInfo")
|
||||||
|
|
||||||
Information("GitResults -> {0}", versionInfo.Dump());
|
Information("GitResults -> {0}", versionInfo.Dump());
|
||||||
|
|
||||||
buildSettings.ArgumentCustomization = args => args.Append("/p:SemVer=" + versionInfo.BuildMetaData);
|
var fullVer = versionInfo.MajorMinorPatch + "-" + versionInfo.BranchName + "-" + versionInfo.BuildMetaData;
|
||||||
publishSettings.ArgumentCustomization = args => args.Append("/p:SemVer=" + versionInfo.BuildMetaData);
|
|
||||||
|
|
||||||
|
buildSettings.ArgumentCustomization = args => args.Append("/p:SemVer=" + versionInfo.AssemblySemVer);
|
||||||
|
buildSettings.ArgumentCustomization = args => args.Append("/p:FullVer=" + fullVer);
|
||||||
|
publishSettings.ArgumentCustomization = args => args.Append("/p:SemVer=" + versionInfo.AssemblySemVer);
|
||||||
|
publishSettings.ArgumentCustomization = args => args.Append("/p:FullVer=" + fullVer);
|
||||||
|
buildSettings.VersionSuffix = versionInfo.BranchName;
|
||||||
|
publishSettings.VersionSuffix = versionInfo.BranchName;
|
||||||
});
|
});
|
||||||
|
|
||||||
Task("Restore")
|
Task("Restore")
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.26730.10
|
VisualStudioVersion = 15.0.26730.8
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi", "Ombi\Ombi.csproj", "{C987AA67-AFE1-468F-ACD3-EAD5A48E1F6A}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi", "Ombi\Ombi.csproj", "{C987AA67-AFE1-468F-ACD3-EAD5A48E1F6A}"
|
||||||
EndProject
|
EndProject
|
||||||
|
@ -9,7 +9,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
..\appveyor.yml = ..\appveyor.yml
|
..\appveyor.yml = ..\appveyor.yml
|
||||||
..\build.cake = ..\build.cake
|
..\build.cake = ..\build.cake
|
||||||
..\BuildTask.ps1 = ..\BuildTask.ps1
|
|
||||||
..\CHANGELOG.md = ..\CHANGELOG.md
|
..\CHANGELOG.md = ..\CHANGELOG.md
|
||||||
..\global.json = ..\global.json
|
..\global.json = ..\global.json
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
|
@ -82,7 +81,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Api.Pushover", "Ombi.A
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Schedule.Tests", "Ombi.Schedule.Tests\Ombi.Schedule.Tests.csproj", "{BDD8B924-016E-4CDA-9FFA-50B0A34BCD3C}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Schedule.Tests", "Ombi.Schedule.Tests\Ombi.Schedule.Tests.csproj", "{BDD8B924-016E-4CDA-9FFA-50B0A34BCD3C}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ombi.Api.Telegram", "Ombi.Api.Telegram\Ombi.Api.Telegram.csproj", "{484A8CA4-C9DC-4033-971D-D9D8EABB957E}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Api.Telegram", "Ombi.Api.Telegram\Ombi.Api.Telegram.csproj", "{484A8CA4-C9DC-4033-971D-D9D8EABB957E}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<TypeScriptToolsVersion>2.3</TypeScriptToolsVersion>
|
<TypeScriptToolsVersion>2.3</TypeScriptToolsVersion>
|
||||||
<AssemblyVersion>$(SemVer)</AssemblyVersion>
|
<AssemblyVersion>$(SemVer)</AssemblyVersion>
|
||||||
<FileVersion>$(SemVer)</FileVersion>
|
<FileVersion>$(SemVer)</FileVersion>
|
||||||
<Version>$(SemVer)</Version>
|
<Version>$(FullVer)</Version>
|
||||||
<PackageVersion></PackageVersion>
|
<PackageVersion></PackageVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,14 @@ namespace Ombi
|
||||||
{
|
{
|
||||||
Console.WriteLine(e);
|
Console.WriteLine(e);
|
||||||
}
|
}
|
||||||
|
c.AddSecurityDefinition("Bearer", new ApiKeyScheme()
|
||||||
|
{
|
||||||
|
Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"",
|
||||||
|
Name = "Authorization",
|
||||||
|
In = "header",
|
||||||
|
Type = "apiKey"
|
||||||
|
});
|
||||||
|
|
||||||
c.AddSecurityDefinition("Authentication", new ApiKeyScheme());
|
c.AddSecurityDefinition("Authentication", new ApiKeyScheme());
|
||||||
c.OperationFilter<SwaggerOperationFilter>();
|
c.OperationFilter<SwaggerOperationFilter>();
|
||||||
c.DescribeAllParametersInCamelCase();
|
c.DescribeAllParametersInCamelCase();
|
||||||
|
@ -189,9 +196,10 @@ namespace Ombi
|
||||||
|
|
||||||
app.UseHangfireServer();
|
app.UseHangfireServer();
|
||||||
app.UseHangfireDashboard();
|
app.UseHangfireDashboard();
|
||||||
app.UseSwagger();
|
|
||||||
app.UseSwaggerUI(c =>
|
app.UseSwaggerUI(c =>
|
||||||
{
|
{
|
||||||
|
|
||||||
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
|
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
|
||||||
c.ShowJsonEditor();
|
c.ShowJsonEditor();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection.Metadata;
|
||||||
|
using Microsoft.AspNetCore.Mvc.ApiExplorer;
|
||||||
using Microsoft.AspNetCore.Mvc.Authorization;
|
using Microsoft.AspNetCore.Mvc.Authorization;
|
||||||
using Swashbuckle.AspNetCore.Swagger;
|
using Swashbuckle.AspNetCore.Swagger;
|
||||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||||
|
@ -8,25 +10,19 @@ namespace Ombi
|
||||||
{
|
{
|
||||||
public class SwaggerOperationFilter : IOperationFilter
|
public class SwaggerOperationFilter : IOperationFilter
|
||||||
{
|
{
|
||||||
|
public string Name { get; private set; }
|
||||||
|
|
||||||
|
public SwaggerOperationFilter()
|
||||||
|
{
|
||||||
|
Name = "Authorization";
|
||||||
|
}
|
||||||
|
|
||||||
public void Apply(Operation operation, OperationFilterContext context)
|
public void Apply(Operation operation, OperationFilterContext context)
|
||||||
{
|
{
|
||||||
var filterPipeline = context.ApiDescription.ActionDescriptor.FilterDescriptors;
|
if (operation.Parameters == null)
|
||||||
var isAuthorized = filterPipeline.Select(filterInfo => filterInfo.Filter).Any(filter => filter is AuthorizeFilter);
|
operation.Parameters = new List<IParameter>();
|
||||||
var allowAnonymous = filterPipeline.Select(filterInfo => filterInfo.Filter).Any(filter => filter is IAllowAnonymousFilter);
|
var tokenAuthDict = new Dictionary<string, IEnumerable<string>> {{Name, new List<string>()}};
|
||||||
if (isAuthorized && !allowAnonymous)
|
operation.Security = new IDictionary<string, IEnumerable<string>>[] { tokenAuthDict };
|
||||||
{
|
|
||||||
if (operation.Parameters == null)
|
|
||||||
operation.Parameters = new List<IParameter>();
|
|
||||||
operation.Parameters.Add(new NonBodyParameter
|
|
||||||
{
|
|
||||||
Name = "Authorization",
|
|
||||||
In = "header",
|
|
||||||
Description = "JWT token",
|
|
||||||
Required = true,
|
|
||||||
Type = "string",
|
|
||||||
Default = "Bearer "
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue