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

Unable to extract version info (windows) #22

Closed AnmolSinha1201 closed 4 years ago

AnmolSinha1201 commented 4 years ago

This is what I am using in my Action yml

    - name: Publish NuGet
      uses: rohith/publish-nuget@v2.2.0
      with:
        PROJECT_FILE_PATH: Source/Source.csproj
        NUGET_KEY: ${{secrets.NUGET_API_KEY}}

But I get

##[error]😒 unable to extract version info!
D:\a\_actions\rohith\publish-nuget\v2.2.0\index.js:24
        throw new Error(msg)
        ^

Error: 😒 unable to extract version info!
    at Action._fail (D:\a\_actions\rohith\publish-nuget\v2.2.0\index.js:24:15)
    at Action.run (D:\a\_actions\rohith\publish-nuget\v2.2.0\index.js:100:22)
    at Object.<anonymous> (D:\a\_actions\rohith\publish-nuget\v2.2.0\index.js:130:14)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
    at internal/main/run_main_module.js:17:11

My Repo : https://github.com/AnmolSinha1201/Surrogate

johnazariah commented 4 years ago

Make sure that your .csproj file has the following tag in a PropertyGroup <Version>1.0</Version> (change the 1.0 to whatever version you want)

AnmolSinha1201 commented 4 years ago

Is there any way it can pick up the version directly from .csproj? Edit: I looked at your JS, it indeed is executing regex on the version file (which defaults to project file). Maybe this is a bug. Any way I can help?

johnazariah commented 4 years ago

Yes - this is a tag you put into the .csproj file!

On Wed, Apr 1, 2020 at 10:20 PM Anmol Sinha notifications@github.com wrote:

Is there any way it can pick up the version directly from .csproj?

β€” You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rohith/publish-nuget/issues/22#issuecomment-607627215, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGKWZ6BMXVWWIYODWLMGSTRKQODBANCNFSM4LZAZNNQ .

-- John Azariah

m +1 425 614 8158 e john.azariah@gmail.com t @johnazariah http://twitter.com/johnazariah

AnmolSinha1201 commented 4 years ago

It's already present in the .csproj file. For some reason, it doesn't pick up the tag

johnazariah commented 4 years ago

I just saw your repo, and the project file seems like it has the tag. Your yaml file doesn't refer anything weird for the regex or anything, so it should get picked up...

Looks like you tried '/' and '\' as separators as well...maybe all the cding you're doing in the previous steps changes something?

Can you create yourself a fork of the publish-nuget repo and refer to that instead, and add some diagnostics to look at the text of the csproj file?

I can't seem to run actions on your repo...

brandedoutcast commented 4 years ago

Thanks for the help @johnazariah

@AnmolSinha1201 I forked your repo & commented out the dotnet test that was failing & it worked as expected.

I saw your attempts to resolve the issue by escaping slash characters but that should be taken care by the script

I'm not sure what's wrong here but I'll keep this one open & maybe add some additional info to the error messages & some logs that might help

johnazariah commented 4 years ago

Great work, mate! :)

Thanks for this action -- very useful!

On Thu, Apr 2, 2020, 21:04 Rohith Reddy notifications@github.com wrote:

I forked your repo & commented out the dotnet test that was failing & it worked as expected.

I saw your attempts to resolve the issue by escaping slash characters but that should be taken care by the script

I'm not sure what's wrong here but I'll keep this one open & maybe add some additional info to the error messages & some logs that might help

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rohith/publish-nuget/issues/22#issuecomment-608216899, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGKWZ4BIDOBKPY36VTX3SDRKVN3RANCNFSM4LZAZNNQ .

AnmolSinha1201 commented 4 years ago

@johnazariah @rohith The tests actually broke yesterday. I had to update the code but couldn't update the tests. I'll fix the tests as soon as possible.

AnmolSinha1201 commented 4 years ago

@rohith @johnazariah I just checked publish-nuget, it works fine now. I'll close the issue.