diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dbae8e3..ea2ccf2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-dotnet@v1 with: - dotnet-version: '3.1.100' + dotnet-version: '3.1.403' - name: Restore Tools shell: bash run: | diff --git a/src/NexusUploader/NexusUploader.csproj b/src/NexusUploader/NexusUploader.csproj index f14b6ab..018e6cc 100644 --- a/src/NexusUploader/NexusUploader.csproj +++ b/src/NexusUploader/NexusUploader.csproj @@ -20,6 +20,7 @@ + diff --git a/src/NexusUploader/UploadCommand.cs b/src/NexusUploader/UploadCommand.cs index 58416e2..15a9bcb 100644 --- a/src/NexusUploader/UploadCommand.cs +++ b/src/NexusUploader/UploadCommand.cs @@ -7,6 +7,8 @@ using Spectre.Cli; using Spectre.Console; using ValidationResult = Spectre.Cli.ValidationResult; +using HandlebarsDotNet; +using DescriptionAttribute = System.ComponentModel.DescriptionAttribute; namespace NexusUploader.Nexus { @@ -28,6 +30,19 @@ public override async Task ExecuteAsync(CommandContext context, Settings se { var config = settings.MergedConfiguration; var fileOpts = new FileOptions(config.FileName, settings.FileVersion) {Description = config.FileDescription }; + try + { + var compAction = Handlebars.Compile(fileOpts.Description); + var result = compAction?.Invoke(fileOpts); + if (!string.IsNullOrWhiteSpace(result) && !string.Equals(fileOpts.Description, result)) { + AnsiConsole.MarkupLine("Compiled description template using current file options."); + fileOpts.Description = result; + } + } + catch (System.Exception ex) + { + AnsiConsole.MarkupLine($"[bold red]ERROR[/]: {ex.Message}"); + } if (settings.SkipMainVersionUpdate.IsSet && settings.SkipMainVersionUpdate.Value) { _logger.LogWarning("Skipping mod version update!"); fileOpts.UpdateMainVersion = false;