diff --git a/.github/workflows/github-publish.yml b/.github/workflows/github-publish.yml index 78ba36d..d4e4eb7 100644 --- a/.github/workflows/github-publish.yml +++ b/.github/workflows/github-publish.yml @@ -75,3 +75,16 @@ jobs: run: dotnet pack "./OmegaLeo.HelperLib.Shared/OmegaLeo.HelperLib.Shared.csproj" -c Release /p:Version=${{ inputs.tag_name }} - name: Publish to GitHub Packages run: dotnet nuget push ./OmegaLeo.HelperLib.Shared/bin/Release/OmegaLeo.HelperLib.Shared.${{ inputs.tag_name }}.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/omegaleo/index.json --skip-duplicate + + publish-xml-lib: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup .Net Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '8.0.x' + - name: Create Nuget Package + run: dotnet pack "./OmegaLeo.HelperLib.XmlDocGenerator/OmegaLeo.HelperLib.XmlDocGenerator.csproj" -c Release /p:Version=${{ inputs.tag_name }} + - name: Publish to GitHub Packages + run: dotnet nuget push ./OmegaLeo.HelperLib.XmlDocGenerator/bin/Release/OmegaLeo.HelperLib.XmlDocGenerator.${{ inputs.tag_name }}.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/omegaleo/index.json --skip-duplicate diff --git a/OmegaLeo.HelperLib.ConsoleApp/OmegaLeo.HelperLib.ConsoleApp.csproj b/OmegaLeo.HelperLib.ConsoleApp/OmegaLeo.HelperLib.ConsoleApp.csproj deleted file mode 100755 index ca1ddff..0000000 --- a/OmegaLeo.HelperLib.ConsoleApp/OmegaLeo.HelperLib.ConsoleApp.csproj +++ /dev/null @@ -1,16 +0,0 @@ - - - - Exe - net8.0 - enable - enable - - - - - - - - - diff --git a/OmegaLeo.HelperLib.ConsoleApp/Program.cs b/OmegaLeo.HelperLib.ConsoleApp/Program.cs deleted file mode 100755 index e56ba62..0000000 --- a/OmegaLeo.HelperLib.ConsoleApp/Program.cs +++ /dev/null @@ -1,102 +0,0 @@ -// See https://aka.ms/new-console-template for more information - -// /media/omegaleo/Development/Library Dev/HelperLib - -using System.Reflection; -using OmegaLeo.HelperLib.Extensions; -using OmegaLeo.HelperLib.Helpers; -using LibGit2Sharp; -using OmegaLeo.HelperLib.Changelog.Tools; -using OmegaLeo.HelperLib.Git; -using OmegaLeo.HelperLib.Git.Models; - -Console.WriteLine("Insert repo path to check changes:"); -var repo = Console.ReadLine(); - -if (repo.IsNullOrEmpty()) -{ - repo = "/media/omegaleo/Development/Library Dev/HelperLib"; -} - -var git = new GitClient(repo); - -var result = BenchmarkUtility.Record(() => -{ - var changes = git.GetChanges(); - - if (changes.FolderName.IsNotNullOrEmpty()) - { - RecursiveOutput(new List() { changes }); - - var option = 99; - - while (option != 0) - { - ShowOptions(); - if (option != 99) - { - switch (option) - { - case 1: - Console.WriteLine("Write the commit message"); - var msg = Console.ReadLine(); - - while (msg.IsNullOrEmpty()) - { - Console.WriteLine("Empty message detected, please write a commit message..."); - msg = Console.ReadLine(); - } - - var signature = new Signature("Nuno 'Omega Leo' Diogo", "nunodiogo@omegaleo.pt", - DateTimeOffset.Now); - git.Commit(msg, signature); - - break; - case 2: - git.Push(); - break; - default: - Console.WriteLine("Invalid Option!"); - break; - } - } - - int.TryParse(Console.ReadLine(), out option); - } - } - else - { - Console.WriteLine("No changes found in specified repository"); - } -}); - -Console.WriteLine($"Time for checking for changes: {result} ms"); - -Console.ReadLine(); - - -void RecursiveOutput(List folders, int depth = 0) -{ - foreach (var folder in folders) - { - Console.WriteLine($"{new string('\t', depth)}>{folder.FolderName}"); - if (folder.SubFolders.Any()) - { - RecursiveOutput(folder.SubFolders, depth + 1); - } - - foreach (var change in folder.ChangesInFolder) - { - Console.WriteLine($"{new string('\t', depth + 1)}>{Path.GetFileName(change.Path)} ({change.Status})"); - } - } -} - -void ShowOptions() -{ - Console.Clear(); - Console.WriteLine(new string('=', 20)); - Console.WriteLine("What do you want to do in this repository?"); - Console.WriteLine("1. Commit all changes"); - Console.WriteLine("2. Push"); -} \ No newline at end of file diff --git a/OmegaLeo.HelperLib.Git/GitClient.cs b/OmegaLeo.HelperLib.Git/GitClient.cs deleted file mode 100755 index 498769e..0000000 --- a/OmegaLeo.HelperLib.Git/GitClient.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using OmegaLeo.HelperLib.Extensions; -using LibGit2Sharp; -using OmegaLeo.HelperLib.Git.Models; - -namespace OmegaLeo.HelperLib.Git -{ - public class GitClient - { - private Repository _repo; - - public GitClient(string path) - { - if (path.IsNullOrEmpty()) - { - path = AppDomain.CurrentDomain.BaseDirectory; - } - - _repo = new Repository(path); - } - - public void CheckoutBranch(string branchName) - { - var branch = _repo.Branches[branchName]; - - if (branch == null) - { - branch = _repo.CreateBranch(branchName); - } - - Commands.Checkout(_repo, branch); - } - - public bool HasChanges() => _repo.Diff.Compare().Count > 0; - - public ChangeFolder GetChanges() - { - var folder = new ChangeFolder(); - - if (HasChanges()) - { - var changes = _repo.Diff.Compare(); - - var allChanges = new List(); - allChanges.AddRange(changes.Added); - allChanges.AddRange(changes.Modified); - allChanges.AddRange(changes.Deleted); - - var uniqueFolderPaths = allChanges.Select(x => Path.GetDirectoryName(x.Path)).Distinct(); - - foreach (var path in uniqueFolderPaths) - { - if (path.IsNullOrEmpty()) continue; - - if (path.Contains(Path.DirectorySeparatorChar)) - { - var paths = path.Split(Path.DirectorySeparatorChar); - - for (var i = 0; i < paths.Length; i++) - { - var p = paths[i]; - - if (folder.FolderName.Equals(p)) - { - if (folder.ChangesInFolder.Any()) continue; - - folder.ChangesInFolder = - allChanges.Where(x => Path.GetDirectoryName(x.Path)!.Equals(p, StringComparison.OrdinalIgnoreCase)); - } - else - { - var pathList = paths[0..(i+1)].ToList(); - var subFolder = folder.RecursiveGet(pathList); - var fullPath = string.Join(Path.DirectorySeparatorChar, pathList); - - if (!subFolder.ChangesInFolder.Any()) - { - subFolder.ChangesInFolder = allChanges.Where(x => - Path.GetDirectoryName(x.Path)!.Equals(fullPath, StringComparison.OrdinalIgnoreCase)); - } - } - } - } - else - { - folder.FolderName = path; - folder.ChangesInFolder = - allChanges.Where(x => Path.GetDirectoryName(x.Path)!.Equals(path, StringComparison.OrdinalIgnoreCase)); - } - } - } - - return folder; - } - - public void Commit(string message, Signature author) - { - if (HasChanges()) - { - var changes = _repo.Diff.Compare(); - var allChanges = new List(); - allChanges.AddRange(changes.Added); - allChanges.AddRange(changes.Modified); - allChanges.AddRange(changes.Deleted); - - var filePaths = allChanges.Select(x => x.Path).Where(x => x.IsNotNullOrEmpty()); - - Commands.Stage(_repo, filePaths); - } - - _repo.Commit(message, author, author); - } - - public void Push() - { - try { - var remote = _repo.Network.Remotes["origin"]; - var options = new PushOptions(); - var pushRefSpec = @"refs/heads/master"; - _repo.Network.Push(remote, new string[] {pushRefSpec}, options); - } - catch (Exception e) { - Console.WriteLine("Exception:RepoActions:PushChanges " + e.Message); - } - } - } -} \ No newline at end of file diff --git a/OmegaLeo.HelperLib.Git/Models/ChangeFolder.cs b/OmegaLeo.HelperLib.Git/Models/ChangeFolder.cs deleted file mode 100755 index ecb9c71..0000000 --- a/OmegaLeo.HelperLib.Git/Models/ChangeFolder.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using LibGit2Sharp; - -namespace OmegaLeo.HelperLib.Git.Models -{ - public class ChangeFolder - { - public string FolderName { get; set; } - public List SubFolders { get; set; } - public IEnumerable ChangesInFolder { get; set; } - - public ChangeFolder() - { - FolderName = ""; - SubFolders = new List(); - ChangesInFolder = new List(); - } - - public ChangeFolder RecursiveGet(List paths) - { - if (!paths.Any()) return null; - - var tempPaths = paths; - var pathToCheck = tempPaths.FirstOrDefault(); - - ChangeFolder folder = new ChangeFolder(); - - if (FolderName.Equals(pathToCheck, StringComparison.OrdinalIgnoreCase)) - { - folder = this; - } - else if (SubFolders.Any(x => x.FolderName.Equals(pathToCheck))) - { - folder = SubFolders.FirstOrDefault(x => x.FolderName.Equals(pathToCheck))!; - } - else - { - folder.FolderName = pathToCheck; - SubFolders.Add(folder); - } - - tempPaths.RemoveAt(0); - - if (tempPaths.Any()) - { - return folder.RecursiveGet(tempPaths); - } - else - { - return folder; - } - } - } -} \ No newline at end of file diff --git a/OmegaLeo.HelperLib.Git/OmegaLeo.HelperLib.Git.csproj b/OmegaLeo.HelperLib.Git/OmegaLeo.HelperLib.Git.csproj deleted file mode 100755 index 944857b..0000000 --- a/OmegaLeo.HelperLib.Git/OmegaLeo.HelperLib.Git.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - netstandard2.1 - enable - OmegaLeo.HelperLib.Git - 0.0.2 - Omega Leo's Helper Library - LibGit2Sharp Implementation - Nuno "Omega Leo" Diogo - https://github.com/omegaleo/HelperLib - https://github.com/omegaleo/HelperLib - - - - - - - - - - - diff --git a/OmegaLeo.HelperLib.Web/OmegaLeo.HelperLib.Web.csproj b/OmegaLeo.HelperLib.Web/OmegaLeo.HelperLib.Web.csproj index 1928e83..3c4ef0d 100755 --- a/OmegaLeo.HelperLib.Web/OmegaLeo.HelperLib.Web.csproj +++ b/OmegaLeo.HelperLib.Web/OmegaLeo.HelperLib.Web.csproj @@ -9,7 +9,6 @@ - diff --git a/OmegaLeo.HelperLib.XmlDocGenerator/OmegaLeo.HelperLib.XmlDocGenerator.csproj b/OmegaLeo.HelperLib.XmlDocGenerator/OmegaLeo.HelperLib.XmlDocGenerator.csproj index 1efa165..d9beac1 100644 --- a/OmegaLeo.HelperLib.XmlDocGenerator/OmegaLeo.HelperLib.XmlDocGenerator.csproj +++ b/OmegaLeo.HelperLib.XmlDocGenerator/OmegaLeo.HelperLib.XmlDocGenerator.csproj @@ -42,4 +42,9 @@ + + + + + diff --git a/OmegaLeo.HelperLib.XmlDocGenerator/Program.cs b/OmegaLeo.HelperLib.XmlDocGenerator/Program.cs index 3697cf7..50afd9a 100644 --- a/OmegaLeo.HelperLib.XmlDocGenerator/Program.cs +++ b/OmegaLeo.HelperLib.XmlDocGenerator/Program.cs @@ -1,4 +1,7 @@ -using System.Reflection; +using System; +using System.IO; +using System.Linq; +using System.Reflection; using System.Runtime.Loader; using System.Text; using System.Xml; diff --git a/OmegaLeo.HelperLib.sln b/OmegaLeo.HelperLib.sln index 938bd8a..cd5cb46 100755 --- a/OmegaLeo.HelperLib.sln +++ b/OmegaLeo.HelperLib.sln @@ -2,10 +2,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OmegaLeo.HelperLib", "OmegaLeo.HelperLib\OmegaLeo.HelperLib.csproj", "{A7256931-5D66-46FA-BA50-22B2FA4CD9E9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OmegaLeo.HelperLib.Git", "OmegaLeo.HelperLib.Git\OmegaLeo.HelperLib.Git.csproj", "{A9579FFB-9A05-4EBF-B298-513C48FB0F91}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OmegaLeo.HelperLib.ConsoleApp", "OmegaLeo.HelperLib.ConsoleApp\OmegaLeo.HelperLib.ConsoleApp.csproj", "{3B77B177-FD47-470A-B0EF-01EF8B30CE09}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OmegaLeo.HelperLib.Changelog", "OmegaLeo.HelperLib.Changelog\OmegaLeo.HelperLib.Changelog.csproj", "{378D8125-66B5-42B8-9881-33F951E5E04A}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OmegaLeo.HelperLib.ChangelogHandler", "OmegaLeo.HelperLib.ChangelogHandler\OmegaLeo.HelperLib.ChangelogHandler.csproj", "{359536F7-02DE-43E9-A383-D83853227B0F}" @@ -60,30 +56,6 @@ Global {A7256931-5D66-46FA-BA50-22B2FA4CD9E9}.Release|x64.Build.0 = Release|Any CPU {A7256931-5D66-46FA-BA50-22B2FA4CD9E9}.Release|x86.ActiveCfg = Release|Any CPU {A7256931-5D66-46FA-BA50-22B2FA4CD9E9}.Release|x86.Build.0 = Release|Any CPU - {A9579FFB-9A05-4EBF-B298-513C48FB0F91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A9579FFB-9A05-4EBF-B298-513C48FB0F91}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A9579FFB-9A05-4EBF-B298-513C48FB0F91}.Debug|x64.ActiveCfg = Debug|Any CPU - {A9579FFB-9A05-4EBF-B298-513C48FB0F91}.Debug|x64.Build.0 = Debug|Any CPU - {A9579FFB-9A05-4EBF-B298-513C48FB0F91}.Debug|x86.ActiveCfg = Debug|Any CPU - {A9579FFB-9A05-4EBF-B298-513C48FB0F91}.Debug|x86.Build.0 = Debug|Any CPU - {A9579FFB-9A05-4EBF-B298-513C48FB0F91}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A9579FFB-9A05-4EBF-B298-513C48FB0F91}.Release|Any CPU.Build.0 = Release|Any CPU - {A9579FFB-9A05-4EBF-B298-513C48FB0F91}.Release|x64.ActiveCfg = Release|Any CPU - {A9579FFB-9A05-4EBF-B298-513C48FB0F91}.Release|x64.Build.0 = Release|Any CPU - {A9579FFB-9A05-4EBF-B298-513C48FB0F91}.Release|x86.ActiveCfg = Release|Any CPU - {A9579FFB-9A05-4EBF-B298-513C48FB0F91}.Release|x86.Build.0 = Release|Any CPU - {3B77B177-FD47-470A-B0EF-01EF8B30CE09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3B77B177-FD47-470A-B0EF-01EF8B30CE09}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3B77B177-FD47-470A-B0EF-01EF8B30CE09}.Debug|x64.ActiveCfg = Debug|Any CPU - {3B77B177-FD47-470A-B0EF-01EF8B30CE09}.Debug|x64.Build.0 = Debug|Any CPU - {3B77B177-FD47-470A-B0EF-01EF8B30CE09}.Debug|x86.ActiveCfg = Debug|Any CPU - {3B77B177-FD47-470A-B0EF-01EF8B30CE09}.Debug|x86.Build.0 = Debug|Any CPU - {3B77B177-FD47-470A-B0EF-01EF8B30CE09}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3B77B177-FD47-470A-B0EF-01EF8B30CE09}.Release|Any CPU.Build.0 = Release|Any CPU - {3B77B177-FD47-470A-B0EF-01EF8B30CE09}.Release|x64.ActiveCfg = Release|Any CPU - {3B77B177-FD47-470A-B0EF-01EF8B30CE09}.Release|x64.Build.0 = Release|Any CPU - {3B77B177-FD47-470A-B0EF-01EF8B30CE09}.Release|x86.ActiveCfg = Release|Any CPU - {3B77B177-FD47-470A-B0EF-01EF8B30CE09}.Release|x86.Build.0 = Release|Any CPU {378D8125-66B5-42B8-9881-33F951E5E04A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {378D8125-66B5-42B8-9881-33F951E5E04A}.Debug|Any CPU.Build.0 = Debug|Any CPU {378D8125-66B5-42B8-9881-33F951E5E04A}.Debug|x64.ActiveCfg = Debug|Any CPU diff --git a/OmegaLeo.HelperLib/.idea/.idea.OmegaLeo.dir/.idea/.name b/OmegaLeo.HelperLib/.idea/.idea.OmegaLeo.dir/.idea/.name new file mode 100644 index 0000000..786dbb5 --- /dev/null +++ b/OmegaLeo.HelperLib/.idea/.idea.OmegaLeo.dir/.idea/.name @@ -0,0 +1 @@ +OmegaLeo \ No newline at end of file diff --git a/OmegaLeo.HelperLib/.idea/.idea.OmegaLeo.dir/.idea/encodings.xml b/OmegaLeo.HelperLib/.idea/.idea.OmegaLeo.dir/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/OmegaLeo.HelperLib/.idea/.idea.OmegaLeo.dir/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/OmegaLeo.HelperLib/.idea/.idea.OmegaLeo.dir/.idea/indexLayout.xml b/OmegaLeo.HelperLib/.idea/.idea.OmegaLeo.dir/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/OmegaLeo.HelperLib/.idea/.idea.OmegaLeo.dir/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/OmegaLeo.HelperLib/.idea/.idea.OmegaLeo.dir/.idea/projectSettingsUpdater.xml b/OmegaLeo.HelperLib/.idea/.idea.OmegaLeo.dir/.idea/projectSettingsUpdater.xml new file mode 100644 index 0000000..ef20cb0 --- /dev/null +++ b/OmegaLeo.HelperLib/.idea/.idea.OmegaLeo.dir/.idea/projectSettingsUpdater.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/OmegaLeo.HelperLib/.idea/.idea.OmegaLeo.dir/.idea/workspace.xml b/OmegaLeo.HelperLib/.idea/.idea.OmegaLeo.dir/.idea/workspace.xml new file mode 100644 index 0000000..af74b27 --- /dev/null +++ b/OmegaLeo.HelperLib/.idea/.idea.OmegaLeo.dir/.idea/workspace.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + 1770849800217 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file