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] error: Response status code does not indicate success: 409 (A package with ID 'laget.Quartz' and version '1.0.0' already exists and cannot be modified.). #60

Open gonace opened 3 years ago

gonace commented 3 years ago

Describe the bug We're trying to use the property VERSION_STATIC with {{github.run_number}} (1.0.${{github.run_number}}) but it does not seem to work, since the generated package builds with version 1.0.0.

The action does not fail even though the nuget API returns Conflcit:

Pushing laget.Quartz.1.0.0.nupkg to 'https://www.nuget.org/api/v2/package'...
  PUT https://www.nuget.org/api/v2/package/
  Conflict https://www.nuget.org/api/v2/package/ 398ms
Package '/home/runner/work/laget.Quartz/laget.Quartz/laget.Quartz.1.0.0.nupkg' already exists at feed 'https://www.nuget.org/api/v2/package

Failed Action Log URL (Required)

Run brandedoutcast/publish-nuget@v2.5.5
  with:
    PROJECT_FILE_PATH: laget.Quartz/laget.Quartz.csproj
    NUGET_KEY: ***
    VERSION_STATIC: 1.0.8
    VERSION_REGEX: ^\s*<Version>(.*)<\/Version>\s*$
    TAG_COMMIT: true
    TAG_FORMAT: v*
    NUGET_SOURCE: https://api.nuget.org
    INCLUDE_SYMBOLS: false
  env:
    DOTNET_ROOT: /home/runner/.dotnet
Project Filepath: laget.Quartz/laget.Quartz.csproj
Version: 1.0.8
Package Name: laget.Quartz
✨ found new version (1.0.8) of laget.Quartz
NuGet Source: https://api.nuget.org
executing: [dotnet build -c Release laget.Quartz/laget.Quartz.csproj]
Microsoft (R) Build Engine version 16.7.2+b60ddb6f4 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
  laget.Quartz -> /home/runner/work/laget.Quartz/laget.Quartz/laget.Quartz/bin/Release/netstandard2.0/laget.Quartz.dll
  laget.Quartz -> /home/runner/work/laget.Quartz/laget.Quartz/laget.Quartz/bin/Release/netstandard2.1/laget.Quartz.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:01.21
executing: [dotnet pack  --no-build -c Release laget.Quartz/laget.Quartz.csproj -o .]
Microsoft (R) Build Engine version 16.7.2+b60ddb6f4 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Successfully created package '/home/runner/work/laget.Quartz/laget.Quartz/laget.Quartz.1.0.0.nupkg'.
Generated Package(s): laget.Quartz.1.0.0.nupkg
executing: [dotnet nuget push *.nupkg -s https://api.nuget.org/v3/index.json -k *** --skip-duplicate -n 1]
Pushing laget.Quartz.1.0.0.nupkg to 'https://www.nuget.org/api/v2/package'...
  PUT https://www.nuget.org/api/v2/package/
  Conflict https://www.nuget.org/api/v2/package/ 398ms
Package '/home/runner/work/laget.Quartz/laget.Quartz/laget.Quartz.1.0.0.nupkg' already exists at feed 'https://www.nuget.org/api/v2/package'.

✨ creating new tag v1.0.8
executing: [git tag v1.0.8]
executing: [git push origin v1.0.8]
To https://github.com/laget-se/laget.Quartz
 * [new tag]         v1.0.8 -> v1.0.8

To Reproduce Steps to reproduce the behavior:

  1. Use configuration from https://github.com/laget-se/laget.Quartz/blob/master/.github/workflows/dotnet.yml

Expected Behavior We're expecting the .nupkg-file to be generated with the version provided via the property VERSION_STATIC

The Pull Request #52 seems to solve this, would be great if that could be merged?

Environment:

gonace commented 3 years ago

Since we needed this functionality right away we were "forced" to fork this repository and add the functionality to our instance of Package Nuget from the PR (#52).

AraHaan commented 3 years ago

What I usually do is have the action never push tags and instead have the action only run only when the workflow runs in a new tag push scenario.

AlphaNecron commented 3 years ago

That's not a bug, version name must be unique, please change it to 1.0.1 or higher.

AraHaan commented 3 years ago

That's not a bug, version name must be unique, please change it to 1.0.1 or higher.

Except it is, the version is set in project but they been experimenting with VERSION_STATIC to append ${{github.run_number}} to the end of it.

AlphaNecron commented 3 years ago

Remove VERSION_REGEX: ^\s*<Version>(.*)<\/Version>\s*$ and see.