diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 941b8e0..cc7ff6f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -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
diff --git a/Controllers/PackagesController.cs b/Controllers/PackagesController.cs
index ac4240d..a777c43 100644
--- a/Controllers/PackagesController.cs
+++ b/Controllers/PackagesController.cs
@@ -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);
diff --git a/Helpers/NuspecCoreReaderHelpers.cs b/Helpers/NuspecCoreReaderHelpers.cs
new file mode 100644
index 0000000..509b97c
--- /dev/null
+++ b/Helpers/NuspecCoreReaderHelpers.cs
@@ -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;
+ }
+ }
+}
\ No newline at end of file
diff --git a/nuget-host.csproj b/nuget-host.csproj
index c123f47..696eb19 100644
--- a/nuget-host.csproj
+++ b/nuget-host.csproj
@@ -15,7 +15,8 @@
-
+
+