broken/ef
Paul Schneider 3 years ago
parent 48df937b7f
commit 445ea24dd2
4 changed files with 37 additions and 13 deletions

@ -8,6 +8,7 @@ before_script:
- echo "Before script section"
- echo "For example you might run an update here or install a build dependency"
- echo "Or perhaps you might print out some debugging details"
- dotnet restore --ignore-failed-sources
after_script:
- echo "After script section"
@ -16,13 +17,12 @@ after_script:
build1:
stage: build
script:
- echo "Do your build here"
- dotnet build
test1:
stage: test
script:
- echo "Do a test here"
- echo "For example run a test suite"
- dotnet test
test2:
stage: test
@ -33,4 +33,9 @@ test2:
deploy1:
stage: deploy
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.Options;
using NuGet.Packaging;
using NuGet.Packaging.Core;
using nuget_host.Entities;
using nuget_host.Helpers;
namespace nuget_host.Controllers
{
@ -39,7 +41,7 @@ namespace nuget_host.Controllers
{
var clientVersionId = Request.Headers["X-NuGet-Client-Version"];
var apiKey = Request.Headers["X-NuGet-ApiKey"];
ViewData["nuget client "] = "nuget {clientVersionId}";
ViewData["nuget client"] = "nuget {clientVersionId}";
var clearkey = protector.Unprotect(apiKey);
if (clearkey!= Startup.RootApiKeySecret)
@ -56,23 +58,23 @@ namespace nuget_host.Controllers
using (FileStream fw = new FileStream(initpath, FileMode.Open))
{
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 specstr = archive.OpenFile(filename);
NuspecReader reader = new NuspecReader(specstr);
var specstr = entry.Open();
NuGet.Packaging.Core.NuspecCoreReader reader = new NuspecCoreReader(specstr);
string pkgdesc = reader.GetDescription();
string pkgid = reader.GetId();
var version = reader.GetVersion();
path = Path.Combine(nugetSettings.PackagesRootDir,
Path.Combine(pkgid,
Path.Combine(version.ToFullString(),
$"{pkgid}-{version}.nupkg")));
Path.Combine(version.Version.ToString()),
$"{pkgid}-{version}.nupkg"));
var source = new FileInfo(initpath);
var dest = new FileInfo(path);
var destdir = new DirectoryInfo(dest.DirectoryName);

@ -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.AspNetCore.All" />
<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="MailKit" Version="2.11.1" />

Loading…