sshnet / SSH.NET

SSH.NET is a Secure Shell (SSH) library for .NET, optimized for parallelism.
http://sshnet.github.io/SSH.NET/
MIT License
3.88k stars 919 forks source link

Integrate with Nerdbank.GitVersioning #1299

Open scott-xu opened 5 months ago

Rob-Hague commented 5 months ago

Interesting. Would this change how one creates a release? If so, what would be the steps required?

scott-xu commented 5 months ago

From reading the doc about nbgv, the first step is to run nbgv prepare-release. See help below

C:\Users\scott\source\repos\scott-xu\SSH.NET> nbgv prepare-release --help
Description:
  Prepares a release by creating a release branch for the current version and adjusting the version on the current branch.

Usage:
  nbgv prepare-release [<tag>] [options]

Arguments:
  <tag>  The prerelease tag to apply on the release branch (if any). If not specified, any existing prerelease tag will be removed. The preceding hyphen may be omitted.

Options:
  -p, --project <project>                The path to the project or project directory. The default is the current directory.
  --nextVersion <nextVersion>            The version to set for the current branch. If omitted, the next version is determined automatically by incrementing the current version.
  --versionIncrement <versionIncrement>  Overrides the 'versionIncrement' setting set in version.json for determining the next version of the current branch.
  -f, --format <json|text>               The format to write information about the release. Allowed values are: text, json. The default is text.
  -?, -h, --help                         Show help and usage information

Then grab a cup of coffee and wait the Appveyor to build the project, generate the nuget package, test the project, and finally deploy the nuget package to nuget.org. Obviously we need to config the Appveyor properly first.

Rob-Hague commented 4 months ago

I get a weird error when building this branch

1>C:\Users\rhague\.nuget\packages\nerdbank.gitversioning\3.7.48-alpha\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018: The "Nerdbank.GitVersioning.Tasks.GetBuildVersion" task failed unexpectedly.
1>C:\Users\rhague\.nuget\packages\nerdbank.gitversioning\3.7.48-alpha\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018: Nerdbank.GitVersioning.GitException: Got a com instead of a tag when opening object 1c7166a002d7633fe1595b3df4634ba0ef6e3138
1>C:\Users\rhague\.nuget\packages\nerdbank.gitversioning\3.7.48-alpha\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:    at Nerdbank.GitVersioning.ManagedGit.GitRepository.TryGetObjectByPath(GitObjectId sha, String objectType, Stream& value)
1>C:\Users\rhague\.nuget\packages\nerdbank.gitversioning\3.7.48-alpha\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:    at Nerdbank.GitVersioning.ManagedGit.GitRepository.TryGetObjectBySha(GitObjectId sha, String objectType, Stream& value)
1>C:\Users\rhague\.nuget\packages\nerdbank.gitversioning\3.7.48-alpha\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:    at Nerdbank.GitVersioning.ManagedGit.GitRepository.<LookupTags>g__HandleCandidate|44_0(GitObjectId pointsAt, String tagName, Boolean isPeeled, <>c__DisplayClass44_0& )
1>C:\Users\rhague\.nuget\packages\nerdbank.gitversioning\3.7.48-alpha\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:    at Nerdbank.GitVersioning.ManagedGit.GitRepository.LookupTags(GitObjectId objectId)
1>C:\Users\rhague\.nuget\packages\nerdbank.gitversioning\3.7.48-alpha\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:    at Nerdbank.GitVersioning.Managed.ManagedGitContext.get_HeadTags()
1>C:\Users\rhague\.nuget\packages\nerdbank.gitversioning\3.7.48-alpha\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:    at Nerdbank.GitVersioning.VersionOracle..ctor(GitContext context, ICloudBuild cloudBuild, Nullable`1 overrideVersionHeightOffset)
1>C:\Users\rhague\.nuget\packages\nerdbank.gitversioning\3.7.48-alpha\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:    at Nerdbank.GitVersioning.Tasks.GetBuildVersion.ExecuteInner() in D:\a\1\s\src\Nerdbank.GitVersioning.Tasks\GetBuildVersion.cs:line 240
1>C:\Users\rhague\.nuget\packages\nerdbank.gitversioning\3.7.48-alpha\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1>C:\Users\rhague\.nuget\packages\nerdbank.gitversioning\3.7.48-alpha\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
Rob-Hague commented 4 months ago

I get a weird error when building this branch

It seems to be a bug in the Nerdbank package, where it does not correctly handle lightweight tags in .git/ref/tags (e.g. 2023.0.1).

In a fresh clone, the tags are in .git/packed-refs which are handled correctly, hence it passing in CI. In my local copy of the repo, the tags are in .git/ref/tags and it is assuming they are all annotated tags.

scott-xu commented 4 months ago

It updates the CI build number: image

Rob-Hague commented 4 months ago

I've not forgotten about this PR, I just want to read up some more on the configuration

scott-xu commented 4 months ago

Not very familar with current release process, but it seems to be some manual work?

WojciechNagorski commented 4 months ago

Yes it is manual

scott-xu commented 4 months ago

I guess the current release process is based on https://github.com/sshnet/BuildTools and https://github.com/sshnet/SSH.NET/blob/develop/build/build.proj, am I right? @WojciechNagorski No matter merge this PR or not, I recommend delegating the release process to appveyor

WojciechNagorski commented 4 months ago

Currently it is just dotnet pack right now.