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

Setup for publishing nugets to nuget.org. #5

Merged
merged 17 commits into from
Mar 8, 2024

Conversation

jorgensigvardsson
Copy link
Contributor

@jorgensigvardsson jorgensigvardsson commented Nov 1, 2023

This is a NuGet build work flow that is triggered on

  • Pushes to main
  • Pull requests
  • Published releases

When pushed to main and when PRs are made, the NuGets will be built and validated (using Meziantou.Framework.NuGetPackageValidation). When releases are published, the same workflow will be executed, but with an added step: the nuget is published to nuget.org.

During the build of the package, the workflow will check if the event is release and the ref name matches the format n.n.n..., that is a version triplet followed by anything. If that is the case, we will setup three environment variables to be used during the nuget build:

  • VERSION - will contain the version triplet
  • FILE_VERSION - will contain the version triplet, with an extra .0 component appended to it to match the .NET file/assembly version format
  • INFORMAL_VERSION - will contain the github ref name (the name of the release)

When the build is not for a release, the variables listed above will be set to:

  • VERSION = 0.0.0
  • FILE_VERSION = 0.0.0.0
  • INFORMAL_VERSION = UNRELEASED

The push operation will assume that there is a secret named NUGET_APIKEY, and that will be used when pushing the package.

@jorgensigvardsson jorgensigvardsson marked this pull request as ready for review November 6, 2023 09:28
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks good,
Should probably consider down the line whether to reenable xml-documentation and symbol requirements, but that's a later concern.

@jorgensigvardsson
Copy link
Contributor Author

Looks good, Should probably consider down the line whether to reenable xml-documentation and symbol requirements, but that's a later concern.

Yeah, that was my thinking as well. The source code doesn't really have much XML-documentation, so I felt we could ignore that for now.

The omission of symbol requirements is just me being lazy at the moment. I figured that since the original doesn't have that enabled, then 🤷 . I guess I'm lazy using Rider that has automatic decompilation and github source code mapping magic...

@carl-andersson-at-westermo carl-andersson-at-westermo merged commit 0901aae into main Mar 8, 2024
5 checks passed
@carl-andersson-at-westermo carl-andersson-at-westermo deleted the change/nuget-publishing branch March 8, 2024 09:21
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.

2 participants