Rewrite NuGet Push GitHub Action
AutomationPanda opened this issue · 4 comments
Boa Constrictor uses a GitHub Action to automatically build and publish a new NuGet package every time the version in the .csproj
file changes in the main
branch. The GitHub Action is located here:
https://github.com/q2ebanking/boa-constrictor/blob/main/.github/workflows/nuget-push.yml
It relies on another GitHub Action named publish-nuget
:
https://github.com/brandedoutcast/publish-nuget
Unfortunately, it appears that the author of this GitHub Action has abandoned it. It would be nice to write our own GitHub Action to do the same thing. That way, we don't depend on someone's abandoned project. Here are some helpful links:
- https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-nuget-push
- brandedoutcast/publish-nuget#21 (comment)
- brandedoutcast/publish-nuget#58
Our new action should do all the same things as the original except handle symbols packages. It doesn't need to be generic enough to handle any package, but it should try to detect version changes and tag commits.
So, oddly enough I was just checking out this issue from another project. I agree completely that there needs to be a new action that actually handles everything more nicely but if you're looking for a duct-tape fix for the time being that does handle symbol packages, you're welcome to use my fork: nitz/publish-nuget@13cf3a0
I was grumpy with it a while back so I "fixed" it to work with .snupkg
s. I won't say I intend to really 'maintain' my fork, but it might be enough just to get you going for the time being.
Cheers!
Thanks for the info, @nitz! This past month, I actually changed the Boa Constrictor project to use DebugType = embedded instead of relying on a symbols package:
https://github.com/q2ebanking/boa-constrictor/blob/main/Boa.Constrictor/Boa.Constrictor.csproj#L15
The current GitHub Action works for now because we don't need to publish a symbols package anymore. However, since it is essentially abandoned, I think Boa Constrictor should not use it. We should either create a new GitHub Action for this project or create a new project (and support it) for a new GitHub Action that does the same thing.
I noticed the suggestion on brandedoutcast
's repo for the archived nuget-push action...
You can replicate the functionality of this action & much more by using the offical tools like dotnet CLI or GitHub CLI etc.
The GitHub CLI can be called inside a GitHub action https://docs.github.com/en/actions/using-workflows/using-github-cli-in-workflows and a lot of handy commands already https://cli.github.com/manual/ https://github.com/NuGet/docs.microsoft.com-nuget/blob/main/docs/reference/nuget-exe-CLI-Reference.md
Right on, @CoffeeAtBedtime! I think the dotnet nuget push
command's --skip-duplicate
option can help us here.