Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate with Nerdbank.GitVersioning #1299

Open
wants to merge 34 commits into
base: develop
Choose a base branch
from
Open

Conversation

scott-xu
Copy link
Collaborator

No description provided.

@Rob-Hague
Copy link
Collaborator

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

@scott-xu scott-xu marked this pull request as draft January 30, 2024 13:12
@scott-xu
Copy link
Collaborator Author

scott-xu commented Jan 30, 2024

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.

…his particular project needs versioning.

include package version in ThisAssembly and use nuget package version for the SSH client version. Since we define the precision of nuget package to "build", it has 3 digits. Nuget package version is unique which should be suffient.
@scott-xu scott-xu marked this pull request as ready for review January 30, 2024 14:48
@Rob-Hague
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator Author

It updates the CI build number:
image

@Rob-Hague
Copy link
Collaborator

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

Copy link
Collaborator

@Rob-Hague Rob-Hague left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that 2024.0.0 already has the commit info tagged to the dll (probably because of sourcelink?):

image

In that case, I am not sure if there still benefits to this change. I am not sure the release process needs to change (it seems simple enough), but as I don't make the releases I think I will have to defer to @WojciechNagorski as to whether to take this change.

version.json Outdated Show resolved Hide resolved
version.json Outdated Show resolved Hide resolved
},
"release": {
"tagName" : "{version}",
"branchName" : "master",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be e.g.

Suggested change
"branchName" : "master",
"branchName" : "release/{version}",

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the curernt release is based on master branch with tag?

@scott-xu
Copy link
Collaborator Author

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

@WojciechNagorski
Copy link
Collaborator

Yes it is manual

@scott-xu
Copy link
Collaborator Author

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
Copy link
Collaborator

Currently it is just dotnet pack right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants