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

[BUG] Unable to extract version info error #38

Closed valchetski closed 4 years ago

valchetski commented 4 years ago

Description Recently started receiving errors during running of action. It says that it can't find version info. Noticed that in 2.5.3 release VERSION_REGEX were changed to ^<Version>(.*)<\/Version>$ which doesn't ignore whitespaces in the beginning of the line

Failed Action Log URL https://github.com/alexvolchetsky/yandex.alice.sdk/runs/864428591?check_suite_focus=true

To Reproduce Test of ^<Version>(.*)<\/Version>$ on content of my .cspoj file: https://regex101.com/r/ZpzZkk/3/ Can't match anything

Expected Behavior Test of ^\s*<Version>(.*)<\/Version>$ on content of my .cspoj file: https://regex101.com/r/ZpzZkk/2/ Matches version info

The same regex works if set VERSION_REGEX explicitly. For instance:

- name: publish on version change
    id: publish_nuget
    uses: rohith/publish-nuget@v2
    with:        
      PROJECT_FILE_PATH: ./src/Yandex.Alice.Sdk/Yandex.Alice.Sdk.csproj
      NUGET_KEY: ${{secrets.NUGET_API_KEY}}
      INCLUDE_SYMBOLS: true
      VERSION_REGEX: ^\s*<Version>(.*)<\/Version>$

Environment:

valchetski commented 4 years ago

@brandedoutcast please check my pr

Logikoz commented 4 years ago

I had the same problem!

marcopandolfo commented 4 years ago

The same problem occurred to me, and i fixed it by explicitly placing the default regex (" (. *) <\ / Version>") in the "VERSION_REGEX" parameter, as was said by @alexvolchetsky

brandedoutcast commented 4 years ago

@alexvolchetsky I'm happy to make ^\s*<Version>(.*)<\/Version>$ as the default regex but I don't see any open PR. I'm pushing it on your behalf as this is bad & needs to be fixed ASAP

Thanks a lot for your contribution 🌟

anibalvelarde commented 4 years ago

hello @alexvolchetsky, in my case, v2.5.3 still runs into the problem of not recognizing the version number correctly in the context of the full XML of the *.csproj file.

I tried the default RegEx, ^<Version>(.*)<\/Version>$, and it did not work. See failure here.

When I try the previous regex with v2.5.3, it works OK. See example RegEx here. But the new RegEx does not. It seems to be having problems matching in the context of the full XML body of the *.csproj file.

Here is an example of the previous regex, <Version>(.*)<\/Version>, working. This may still be an issue. I'm trying to determine if it a problem specific to me.

valchetski commented 4 years ago

hello @anibalvelarde , can you please try to use latest v2.5.4 and remove VERSION_REGEX: (.*)<\/Version> from your pipeline? That might solve your issue

anibalvelarde commented 4 years ago

Hello @alexvolchetsky, I was able to re-try with v2.5.4. Happy to report it worked like a charm! Thanks!

Leitee commented 3 years ago

In my case, it was due I was using the Label attribute in the tag. 0.9.1. By using JS console, I managed to make it work by just removing that attribute. image