ngh
This commit is contained in:
@ -8,6 +8,7 @@ before_script:
|
|||||||
- echo "Before script section"
|
- echo "Before script section"
|
||||||
- echo "For example you might run an update here or install a build dependency"
|
- echo "For example you might run an update here or install a build dependency"
|
||||||
- echo "Or perhaps you might print out some debugging details"
|
- echo "Or perhaps you might print out some debugging details"
|
||||||
|
- dotnet restore --ignore-failed-sources
|
||||||
|
|
||||||
after_script:
|
after_script:
|
||||||
- echo "After script section"
|
- echo "After script section"
|
||||||
@ -16,13 +17,12 @@ after_script:
|
|||||||
build1:
|
build1:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- echo "Do your build here"
|
- dotnet build
|
||||||
|
|
||||||
test1:
|
test1:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- echo "Do a test here"
|
- dotnet test
|
||||||
- echo "For example run a test suite"
|
|
||||||
|
|
||||||
test2:
|
test2:
|
||||||
stage: test
|
stage: test
|
||||||
@ -33,4 +33,9 @@ test2:
|
|||||||
deploy1:
|
deploy1:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
script:
|
script:
|
||||||
- echo "Do your deploy here"
|
- dotnet publish --self-contained --version-suffix ci --configuration Release --ignore-failed-sources
|
||||||
|
|
||||||
|
deploy2:
|
||||||
|
stage: deploy
|
||||||
|
script:
|
||||||
|
- dotnet pack --self-contained --version-suffix ci --configuration Release --ignore-failed-sources
|
||||||
|
@ -9,7 +9,9 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using NuGet.Packaging;
|
using NuGet.Packaging;
|
||||||
|
using NuGet.Packaging.Core;
|
||||||
using nuget_host.Entities;
|
using nuget_host.Entities;
|
||||||
|
using nuget_host.Helpers;
|
||||||
|
|
||||||
namespace nuget_host.Controllers
|
namespace nuget_host.Controllers
|
||||||
{
|
{
|
||||||
@ -39,7 +41,7 @@ namespace nuget_host.Controllers
|
|||||||
{
|
{
|
||||||
var clientVersionId = Request.Headers["X-NuGet-Client-Version"];
|
var clientVersionId = Request.Headers["X-NuGet-Client-Version"];
|
||||||
var apiKey = Request.Headers["X-NuGet-ApiKey"];
|
var apiKey = Request.Headers["X-NuGet-ApiKey"];
|
||||||
ViewData["nuget client "] = "nuget {clientVersionId}";
|
ViewData["nuget client"] = "nuget {clientVersionId}";
|
||||||
|
|
||||||
var clearkey = protector.Unprotect(apiKey);
|
var clearkey = protector.Unprotect(apiKey);
|
||||||
if (clearkey!= Startup.RootApiKeySecret)
|
if (clearkey!= Startup.RootApiKeySecret)
|
||||||
@ -56,23 +58,23 @@ namespace nuget_host.Controllers
|
|||||||
using (FileStream fw = new FileStream(initpath, FileMode.Open))
|
using (FileStream fw = new FileStream(initpath, FileMode.Open))
|
||||||
{
|
{
|
||||||
var archive = new System.IO.Compression.ZipArchive(fw);
|
var archive = new System.IO.Compression.ZipArchive(fw);
|
||||||
foreach (var filename in archive.GetFiles())
|
|
||||||
|
foreach (var entry in archive.Entries)
|
||||||
{
|
{
|
||||||
if (filename.EndsWith(".nuspec"))
|
if (entry.FullName.EndsWith(".nuspec"))
|
||||||
{
|
{
|
||||||
// var entry = archive.GetEntry(filename);
|
// var entry = archive.GetEntry(filename);
|
||||||
var specstr = archive.OpenFile(filename);
|
var specstr = entry.Open();
|
||||||
NuspecReader reader = new NuspecReader(specstr);
|
NuGet.Packaging.Core.NuspecCoreReader reader = new NuspecCoreReader(specstr);
|
||||||
|
|
||||||
string pkgdesc = reader.GetDescription();
|
string pkgdesc = reader.GetDescription();
|
||||||
string pkgid = reader.GetId();
|
string pkgid = reader.GetId();
|
||||||
var version = reader.GetVersion();
|
var version = reader.GetVersion();
|
||||||
|
|
||||||
|
|
||||||
path = Path.Combine(nugetSettings.PackagesRootDir,
|
path = Path.Combine(nugetSettings.PackagesRootDir,
|
||||||
Path.Combine(pkgid,
|
Path.Combine(pkgid,
|
||||||
Path.Combine(version.ToFullString(),
|
Path.Combine(version.Version.ToString()),
|
||||||
$"{pkgid}-{version}.nupkg")));
|
$"{pkgid}-{version}.nupkg"));
|
||||||
var source = new FileInfo(initpath);
|
var source = new FileInfo(initpath);
|
||||||
var dest = new FileInfo(path);
|
var dest = new FileInfo(path);
|
||||||
var destdir = new DirectoryInfo(dest.DirectoryName);
|
var destdir = new DirectoryInfo(dest.DirectoryName);
|
||||||
|
16
Helpers/NuspecCoreReaderHelpers.cs
Normal file
16
Helpers/NuspecCoreReaderHelpers.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
using NuGet.Packaging.Core;
|
||||||
|
|
||||||
|
namespace nuget_host.Helpers
|
||||||
|
{
|
||||||
|
public static class NuspecCoreReaderHelpers
|
||||||
|
{
|
||||||
|
public static string GetDescription(this NuspecCoreReader reader)
|
||||||
|
{
|
||||||
|
var meta = reader.GetMetadata();
|
||||||
|
var kv = meta.SingleOrDefault(i => i.Key == "description");
|
||||||
|
return kv.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -15,7 +15,8 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.All" />
|
<PackageReference Include="Microsoft.AspNetCore.All" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
<PackageReference Include="Microsoft.AspNetCore.App" />
|
||||||
<PackageReference Include="NuGet.Packaging.Core" Version="5.9.0" />
|
<PackageReference Include="NuGet.Packaging.Core" />
|
||||||
|
<PackageReference Include="NuGet.Versioning" Version="3.2.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.1.1" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.1.1" />
|
||||||
|
|
||||||
<PackageReference Include="MailKit" Version="2.11.1" />
|
<PackageReference Include="MailKit" Version="2.11.1" />
|
||||||
|
Reference in New Issue
Block a user