samuelneff / MimeTypeMap

Provides a huge dictionary of file extensions to mime types.
MIT License
622 stars 201 forks source link

Nuget package using GitHub actions #100

Closed IngvarX closed 4 years ago

IngvarX commented 4 years ago

Hello!

Thanks for you library, I found it useful. But the only problem it's not published to Nuget so I can't integrate it into my app easily. What do you think about publishing packages using GitHub action? Here is link: https://github.com/marketplace/actions/publish-nuget All you need is to login on https://www.nuget.org/ and create key, add yaml file with configuration to your solution. If it's not fine for you I can upload latest package to Nuget but it will be manual approach.

samuelneff commented 4 years ago

It's up!

https://www.nuget.org/packages/MimeTypeMapOfficial

I updated Readme to point to this one.

I don't know if the action is working. This one I uploaded manually. Perhaps the first time it has to be manual. The action ran when I added it but it didn't create the package. I'll try the action again for next push.

Thanks for the extra info. I'm happy to finally have this done.

samuelneff commented 4 years ago

@IngvarX I'm having trouble getting the action to work. The latest I'm getting is

The specified API key is invalid, has expired, or does not have permission to access the specified package.

I generated two API keys within NuGet and added them to GitHub as NUGET_API_KEY and NUGET_API_KEY2 and neither work. Both have the NuGet package checked under available packages. One has a glob pattern * and the other has the full package name MimeTypeMapOfficial.

The exact same command with the same API key works locally. Seems likely a problem on GitHub side passing API key. If I set it to an invalid name in the yml file then I get a different error; could not find API key. So it's definitely finding the key. I dunno why NuGet is saying 403.

Any thoughts on what I've configured wrong?

IngvarX commented 4 years ago

This is how I added same action to one of my repos: 1) I opened add API key page and selected my package in Available Packages: image 2) Copied generated key and inserted it here: image

I checked your action build and found this line here:

Successfully created package '/home/runner/work/MimeTypeMap/MimeTypeMap/MimeTypeMap.1.0.5.nupkg'.

I suppose there is name conflict. MimeTypeMap is not a name of your package (not sure nut maybe it should be MimeTypeMapOfficial), probably you should change PackageId?

ferronsw commented 4 years ago

This package isn't working for .Net Core, but it should right? Maybe a settings that's not correct?

samuelneff commented 4 years ago

1.0.7 had a problem packaging but 1.0.8 fixes it. It should work for .net core 2.x and 3.x, as well as .NET 4.x and 2.0.