Skip to content

Commit 58b6fb9

Browse files
committed
Merge branch 'release/0.16.0'
* release/0.16.0: (36 commits) Bump Octokit from 7.1.0 to 9.0.0 in /src Bump Microsoft.NET.Test.Sdk from 17.7.2 to 17.8.0 in /src Bump NSubstitute from 5.0.0 to 5.1.0 in /src Bump Scriban from 5.7.0 to 5.9.0 in /src Bump IDisposableAnalyzers from 4.0.6 to 4.0.7 in /src Bump Roslynator.Analyzers from 4.5.0 to 4.6.2 in /src Bump YamlDotNet from 13.7.0 to 13.7.1 in /src Bump NUnit from 3.13.3 to 3.14.0 in /src Bump ApprovalTests from 5.8.0 to 5.9.0 in /src Remove unnecessary entries in nuspec files Update src/GitReleaseManager.Cli/GitReleaseManager.Cli.csproj Adjust the nuget nuspec and the chocolatey nuspec to reflect the fact the GitReleaseMAnager.Cli targets net6.0 Switch Cli to only net6.0 and Core to net6.0 and net7.0 (maint) Refactor IoC registration (maint) Update wording and handling of culture (maint) Remove unnecessary code (maint) Fix warnings about lack of culture info (#146) Alter scriban template (#146) Prevent usage of unsupported functionality (#146) Add GitLab VCS Provider ...
2 parents f40b2c9 + 8fd591f commit 58b6fb9

File tree

56 files changed

+961
-230
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+961
-230
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
os: [ windows-2022 ]
2121

2222
env:
23-
GITTOOLS_GITHUB_TOKEN: ${{ secrets.GITOOLS_GITHUB_TOKEN }}
23+
GITTOOLS_GITHUB_TOKEN: ${{ secrets.GITTOOLS_GITHUB_TOKEN }}
2424
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
2525
NUGET_SOURCE: https://api.nuget.org/v3/index.json
2626
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}
@@ -43,7 +43,7 @@ jobs:
4343
- name: Fetch all tags and branches
4444
run: git fetch --prune --unshallow
4545

46-
- name: Install .NET SDK 2.1.x and 5.0.x
46+
- name: Install .NET SDK 2.1.x, 3.1.x, 5.0.x, and 6.0.x
4747
uses: actions/setup-dotnet@v3
4848
with:
4949
dotnet-version: |

nuspec/chocolatey/GitReleaseManager.Portable.nuspec

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@
1919
<tags>github release notes create export</tags>
2020
</metadata>
2121
<files>
22-
<file src="..\..\BuildArtifacts\temp\_PublishedApplications\GitReleaseManager.Cli\net48\*.exe" target="tools" />
23-
<file src="..\..\BuildArtifacts\temp\_PublishedApplications\GitReleaseManager.Cli\net48\*.dll" target="tools" exclude="**\Serilog.Sinks.Debug.dll" />
24-
<file src="..\..\BuildArtifacts\temp\_PublishedApplications\GitReleaseManager.Cli\net48\*.pdb" target="tools" />
25-
<file src="..\..\BuildArtifacts\temp\_PublishedApplications\GitReleaseManager.Cli\net48\*.exe.config" target="tools" />
22+
<file src="..\..\BuildArtifacts\temp\_PublishedApplications\GitReleaseManager.Cli\net6.0\*.exe" target="tools" />
23+
<file src="..\..\BuildArtifacts\temp\_PublishedApplications\GitReleaseManager.Cli\net6.0\*.pdb" target="tools" />
2624
<file src="chocolateyInstall.ps1" target="tools"/>
2725
<file src="chocolateyUninstall.ps1" target="tools"/>
2826
<file src="VERIFICATION.TXT" />

nuspec/nuget/GitReleaseManager.nuspec

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@
2020
<tags>github release notes create export</tags>
2121
</metadata>
2222
<files>
23-
<file src="..\..\BuildArtifacts\temp\_PublishedApplications\GitReleaseManager.Cli\net48\*.exe" target="tools" />
24-
<file src="..\..\BuildArtifacts\temp\_PublishedApplications\GitReleaseManager.Cli\net48\*.exe.config" target="tools" />
25-
<file src="..\..\BuildArtifacts\temp\_PublishedApplications\GitReleaseManager.Cli\net48\*.xml" target="tools" />
26-
<file src="..\..\BuildArtifacts\temp\_PublishedApplications\GitReleaseManager.Cli\net48\*.dll" target="tools" exclude="**\Serilog.Sinks.Debug.dll" />
27-
<file src="..\..\BuildArtifacts\temp\_PublishedApplications\GitReleaseManager.Cli\net48\*.pdb" target="tools" />
23+
<file src="..\..\BuildArtifacts\temp\_PublishedApplications\GitReleaseManager.Cli\net6.0\*.exe" target="tools" />
24+
<file src="..\..\BuildArtifacts\temp\_PublishedApplications\GitReleaseManager.Cli\net6.0\*.xml" target="tools" />
25+
<file src="..\..\BuildArtifacts\temp\_PublishedApplications\GitReleaseManager.Cli\net6.0\*.pdb" target="tools" />
2826
<file src="..\..\icons\package_icon.png" target="" />
2927
</files>
3028
</package>

src/Directory.Build.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@
1414
</ItemGroup>
1515

1616
<ItemGroup>
17-
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.3">
17+
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.4">
1818
<PrivateAssets>all</PrivateAssets>
1919
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2020
</PackageReference>
2121
<PackageReference Include="Serilog" Version="3.0.1" />
22-
<PackageReference Include="IDisposableAnalyzers" Version="4.0.6">
22+
<PackageReference Include="IDisposableAnalyzers" Version="4.0.7">
2323
<PrivateAssets>all</PrivateAssets>
2424
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2525
</PackageReference>
2626
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
2727
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2828
<PrivateAssets>all</PrivateAssets>
2929
</PackageReference>
30-
<PackageReference Include="Roslynator.Analyzers" Version="4.4.0">
30+
<PackageReference Include="Roslynator.Analyzers" Version="4.6.2">
3131
<PrivateAssets>All</PrivateAssets>
3232
</PackageReference>
3333
</ItemGroup>

src/GitReleaseManager.Cli/GitReleaseManager.Cli.csproj

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
<LangVersion>8.0</LangVersion>
44
<OutputType>Exe</OutputType>
55
<AssemblyName>GitReleaseManager</AssemblyName>
6-
<TargetFrameworks>net48;net6.0;net7.0</TargetFrameworks>
6+
<TargetFrameworks>net6.0</TargetFrameworks>
7+
<PublishSingleFile>true</PublishSingleFile>
8+
<SelfContained>true</SelfContained>
9+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
710
<Title>GitReleaseManager.Cli</Title>
811
<Description>Create release notes in markdown given a milestone</Description>
912
<IsPackable>false</IsPackable>
@@ -20,7 +23,7 @@
2023
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2124
<PrivateAssets>all</PrivateAssets>
2225
</PackageReference>
23-
<PackageReference Include="Octokit" Version="7.1.0" />
26+
<PackageReference Include="Octokit" Version="9.0.0" />
2427
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
2528
<PackageReference Include="Serilog.Sinks.Debug" Version="2.0.0" PrivateAssets="All" />
2629
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />

src/GitReleaseManager.Cli/Program.cs

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
using GitReleaseManager.Core.Commands;
99
using GitReleaseManager.Core.Configuration;
1010
using GitReleaseManager.Core.Helpers;
11+
using GitReleaseManager.Core.Model;
1112
using GitReleaseManager.Core.Options;
1213
using GitReleaseManager.Core.Provider;
1314
using GitReleaseManager.Core.ReleaseNotes;
1415
using GitReleaseManager.Core.Templates;
1516
using Microsoft.Extensions.DependencyInjection;
17+
using NGitLab;
1618
using Octokit;
1719
using Serilog;
1820

@@ -96,7 +98,6 @@ private static void RegisterServices(BaseSubOptions options)
9698
.AddSingleton<IFileSystem>(fileSystem)
9799
.AddSingleton<IReleaseNotesExporter, ReleaseNotesExporter>()
98100
.AddSingleton<IReleaseNotesBuilder, ReleaseNotesBuilder>()
99-
.AddSingleton<IVcsProvider, GitHubProvider>()
100101
.AddSingleton<IVcsService, VcsService>();
101102

102103
if (options is BaseVcsOptions vcsOptions)
@@ -106,9 +107,7 @@ private static void RegisterServices(BaseSubOptions options)
106107
throw new Exception("The token option is not defined");
107108
}
108109

109-
var gitHubClient = new GitHubClient(new ProductHeaderValue("GitReleaseManager")) { Credentials = new Credentials(vcsOptions.Token) };
110-
serviceCollection = serviceCollection
111-
.AddSingleton<IGitHubClient>(gitHubClient);
110+
RegisterVcsProvider(vcsOptions, serviceCollection);
112111
}
113112

114113
serviceCollection = serviceCollection
@@ -192,10 +191,28 @@ private static Task<int> ExecuteCommand<TOptions>(TOptions options)
192191
where TOptions : BaseSubOptions
193192
{
194193
var command = _serviceProvider.GetRequiredService<ICommand<TOptions>>();
195-
return command.Execute(options);
194+
return command.ExecuteAsync(options);
196195
}
197196

198197
private static void LogOptions(BaseSubOptions options)
199198
=> Log.Debug("{@Options}", options);
199+
200+
private static void RegisterVcsProvider(BaseVcsOptions vcsOptions, IServiceCollection serviceCollection)
201+
{
202+
Log.Information("Using {Provider} as VCS Provider", vcsOptions.Provider);
203+
if (vcsOptions.Provider == VcsProvider.GitLab)
204+
{
205+
serviceCollection
206+
.AddSingleton<IGitLabClient>((_) => new GitLabClient("https://gitlab.com", vcsOptions.Token))
207+
.AddSingleton<IVcsProvider, GitLabProvider>();
208+
}
209+
else
210+
{
211+
// default to Github
212+
serviceCollection
213+
.AddSingleton<IGitHubClient>((_) => new GitHubClient(new ProductHeaderValue("GitReleaseManager")) { Credentials = new Credentials(vcsOptions.Token) })
214+
.AddSingleton<IVcsProvider, GitHubProvider>();
215+
}
216+
}
200217
}
201218
}

src/GitReleaseManager.Core.Tests/Commands/AddAssetsCommandTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public async Task Should_Execute_Command()
3838
_vcsService.AddAssetsAsync(options.RepositoryOwner, options.RepositoryName, options.TagName, options.AssetPaths).
3939
Returns(Task.CompletedTask);
4040

41-
var result = await _command.Execute(options).ConfigureAwait(false);
41+
var result = await _command.ExecuteAsync(options).ConfigureAwait(false);
4242
result.ShouldBe(0);
4343

4444
await _vcsService.Received(1).AddAssetsAsync(options.RepositoryOwner, options.RepositoryName, options.TagName, options.AssetPaths).ConfigureAwait(false);

src/GitReleaseManager.Core.Tests/Commands/CloseCommandTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public async Task Should_Execute_Command()
3636
_vcsService.CloseMilestoneAsync(options.RepositoryOwner, options.RepositoryName, options.Milestone)
3737
.Returns(Task.CompletedTask);
3838

39-
var result = await _command.Execute(options).ConfigureAwait(false);
39+
var result = await _command.ExecuteAsync(options).ConfigureAwait(false);
4040
result.ShouldBe(0);
4141

4242
await _vcsService.Received(1).CloseMilestoneAsync(options.RepositoryOwner, options.RepositoryName, options.Milestone).ConfigureAwait(false);

src/GitReleaseManager.Core.Tests/Commands/CreateCommandTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public async Task Should_Create_Empty_Release()
4343
_vcsService.CreateEmptyReleaseAsync(options.RepositoryOwner, options.RepositoryName, options.Name, options.TargetCommitish, options.Prerelease)
4444
.Returns(_release);
4545

46-
var result = await _command.Execute(options).ConfigureAwait(false);
46+
var result = await _command.ExecuteAsync(options).ConfigureAwait(false);
4747
result.ShouldBe(0);
4848

4949
await _vcsService.Received(1).CreateEmptyReleaseAsync(options.RepositoryOwner, options.RepositoryName, releaseName, options.TargetCommitish, options.Prerelease).ConfigureAwait(false);
@@ -72,7 +72,7 @@ public async Task Should_Create_Release_From_Milestone(string name, int logVerbo
7272
_vcsService.CreateReleaseFromMilestoneAsync(options.RepositoryOwner, options.RepositoryName, options.Milestone, releaseName, options.TargetCommitish, options.AssetPaths, options.Prerelease, options.Template)
7373
.Returns(_release);
7474

75-
var result = await _command.Execute(options).ConfigureAwait(false);
75+
var result = await _command.ExecuteAsync(options).ConfigureAwait(false);
7676
result.ShouldBe(0);
7777

7878
await _vcsService.Received(1).CreateReleaseFromMilestoneAsync(options.RepositoryOwner, options.RepositoryName, options.Milestone, releaseName, options.TargetCommitish, options.AssetPaths, options.Prerelease, options.Template).ConfigureAwait(false);
@@ -98,7 +98,7 @@ public async Task Should_Create_Release_From_InputFile()
9898
_vcsService.CreateReleaseFromInputFileAsync(options.RepositoryOwner, options.RepositoryName, options.Name, options.InputFilePath, options.TargetCommitish, options.AssetPaths, options.Prerelease)
9999
.Returns(_release);
100100

101-
var result = await _command.Execute(options).ConfigureAwait(false);
101+
var result = await _command.ExecuteAsync(options).ConfigureAwait(false);
102102
result.ShouldBe(0);
103103

104104
await _vcsService.Received(1).CreateReleaseFromInputFileAsync(options.RepositoryOwner, options.RepositoryName, options.Name, options.InputFilePath, options.TargetCommitish, options.AssetPaths, options.Prerelease).ConfigureAwait(false);

src/GitReleaseManager.Core.Tests/Commands/DiscardCommandTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public async Task Should_Execute_Command()
3636
_vcsService.DiscardReleaseAsync(options.RepositoryOwner, options.RepositoryName, options.Milestone)
3737
.Returns(Task.CompletedTask);
3838

39-
var result = await _command.Execute(options).ConfigureAwait(false);
39+
var result = await _command.ExecuteAsync(options).ConfigureAwait(false);
4040
result.ShouldBe(0);
4141

4242
await _vcsService.Received(1).DiscardReleaseAsync(options.RepositoryOwner, options.RepositoryName, options.Milestone).ConfigureAwait(false);

0 commit comments

Comments
 (0)