jcansdale / gpr

A .NET Core tool for working with the GitHub Package Registry
93 stars 13 forks source link

Strip any NuGet version metadata #93

Closed jcansdale closed 3 years ago

jcansdale commented 4 years ago

GitHub Packages isn't currently compatible with version metadata. Packages with metadata will upload successfully, but won't be accessible. This PR strips any metadata before uploading the package.

When a package version includes metadata, the output should look like:

Found 1 package.
[PackageWithMetadata.1.0.0.nupkg]: Stripping Metadata: metadata, from Version: 1.0.0+metadata
[PackageWithMetadata.1.0.0.nupkg]: Repository url: https://github.com/jcansdale-test/foo. Version: 1.0.0. Size: 5314 bytes.
[PackageWithMetadata.1.0.0.nupkg]: Uploading package.

How to test

  1. Copy this nuget.config into a new directory
  2. From the same directory do dotnet tool update gpr --version 0.1.237-gadc903af74 -g
  3. Try pushing a package with a version that includes metadata (e.g. gpr push your.pkg -k <PAT>)

Fixes #92

jcansdale commented 4 years ago

Hey @peters, if you have a moment could you review this PR? 🙏

PathogenDavid commented 4 years ago

Can confirm this fixes #92 https://github.com/PathogenPlayground/GitHubPackagesBuildMetadataTest/actions/runs/216709279

For the sake of completeness, I tested with an explicit --version and can confirm it also works as expected: https://github.com/PathogenPlayground/GitHubPackagesBuildMetadataTest/actions/runs/216713992

Thanks for getting that fixed!

jcansdale commented 4 years ago

@PathogenDavid excellent, thanks for testing this!

jcansdale commented 4 years ago

This has been tested and shown to work. It doesn't have test coverage though 😊 . I should really create some integrations tests!

jcansdale commented 3 years ago

This has since been fixed in GitHub Packages.

No need to merge this.