This commit is contained in:
2025-05-13 01:22:44 +03:00
parent 245b02f962
commit 03602b8138
27 changed files with 2078 additions and 1 deletions
+31
View File
@@ -0,0 +1,31 @@
using Actions.Library;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Actions.Nuget {
public class Nuget {
public static void DeletePackage(string repository, string packageName, string packageVersion) {
var result = SystemProcess.Run("dotnet", $"nuget delete {packageName} {packageVersion} -s {repository} --non-interactive");
if (!result.Succeeded) {
throw new Exception("Failed to delete nuget package");
}
}
public static void PushPackage(string repository, string packageFilePath, string? workingDirectory = null) {
var result = SystemProcess.Run("dotnet", $"nuget push --source {repository} {packageFilePath}", workingDirectory);
if (!result.Succeeded) {
throw new Exception("Failed to push nuget package");
}
}
public static void PackPackage(string workingDirectory) {
var result = SystemProcess.Run("nuget", "pack", workingDirectory);
if (!result.Succeeded) {
throw new Exception($"Failed to pack nuget package: {string.Join("\n", result.StdError)}");
}
}
}
}