brandedoutcast / publish-nuget

📦 GitHub action to automate publishing NuGet packages when project version changes
https://github.com/marketplace/actions/publish-nuget
MIT License
197 stars 101 forks source link

Nuget not published even if stage was successful (windows) #24

Closed AnmolSinha1201 closed 4 years ago

AnmolSinha1201 commented 4 years ago

Workflow for reference : link It detects the version change successfully, but it doesn't update the nuget. The API key I provided has complete access, so that shouldn't be an issue. Nuget link : link

brandedoutcast commented 4 years ago

There's additional logging added in v2.2.1, upgrade to that so I can help you

AnmolSinha1201 commented 4 years ago

Check this out link

Successfully created package 'D:\a\Surrogate\Surrogate\Surrogate.2.0.1.nupkg'.
Generated Package: undefined
error: File does not exist (undefined).
brandedoutcast commented 4 years ago

I see the issue but even then the action should've failed. I'll fix that

The action by default looks for a package with the same name as the project file. In this case it's looking for Source, You can fix this with the input PACKAGE_NAME as mentioned in the readme

AnmolSinha1201 commented 4 years ago

Just to be clear, what should be the name of the package?

Also, could you add a feature to look for AssemblyName (similar to how you pick up the version. That way, you can have a regex looking for {AssemblyName}.{Version} to automatically pick up the package. Furthermore, this behavior is default for creating packages (either {csprojName}.{Version} or {AssemblyName}.{Version} when specified). You can look for all "candidate" packages (like one with csproj, one with assembly name and version and so on) or you can have a "strategy" variable which can tell your action about the correct mode.

brandedoutcast commented 4 years ago

Yeah, I realized the options have grown since v1 & it's kinda confusing right now so I'll try to make it clear on how to configure the action

I think I'll check with all the combinations that could be used to determine stuff like this before falling back for an explicit input

I believe your package is Surrogate so your workflow should be like this

- name: Publish NuGet
      uses: rohith/publish-nuget@v2.2.1
      with:
        PROJECT_FILE_PATH: Source\Source.csproj
        NUGET_KEY: ${{secrets.NUGET_API_KEY}}
        PACKAGE_NAME: Surrogate
AnmolSinha1201 commented 4 years ago

It is Surrogate. Can you also pick that up from .csproj just like you're picking up Version? Any package name depends upon ApplicationName, Version, VersionPrefix, VersionSuffix and so on. If it looks like a lot of configuration on your end, I'll change my pipeline.

brandedoutcast commented 4 years ago

I plan to do it but it will take time as there's a lot of places this info can come from. Picking from csproj works if it's configured to have that info but if you look at the previous issues on this action a lot of projects didn't have them configured in csproj & some projects might wanna override that info in the workflow

I'll need to check all these source combinations & then make changes. So, rather than waiting for these changes it's simpler to use the PACKAGE_NAME with Surrogate as it was added for this sole purpose

AnmolSinha1201 commented 4 years ago

@rohith I added the PACKAGE_NAME, but I still get

Successfully created package 'D:\a\Surrogate\Surrogate\Surrogate.2.0.1.nupkg'.
Generated Package: undefined
error: File does not exist (undefined).
AnmolSinha1201 commented 4 years ago

Bump

oliversturm commented 4 years ago

I have no idea if this will help your issue, but I notice that PACKAGE_NAME is misspelled as PACAKGE_NAME in your yaml file here: https://github.com/AnmolSinha1201/Surrogate/blob/master/.github/workflows/dotnetcore.yml

brandedoutcast commented 4 years ago

Thanks @oliversturm yes there's a typo in PACKAGE_NAME & @AnmolSinha1201 you can see it in the logs, I see you just copy pasted my comment with the typo, fix that & it'll work

Closing this for now, reopen if the issue persists

AnmolSinha1201 commented 4 years ago

That was a great catch @oliversturm . Thanks for the support @rohith