-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for overriding repository url, version and uploading multiple packages simultaneously using a glob pattern (wildcards) #53
Conversation
391667c
to
cd37290
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is very much appreciated, thank you! 🙏
I'm wondering if it would make sense to simplify this to take a repository
( e.g. OWNER/REPOSITORY
) rather than a repository URL? That would make it easy to use ${{ github.repository }}
in a publish workflow, which will probably be the most common configuration.
…ushing nupkg to GPR. Fixes jcansdale#48 Update error message. Remove dead code because there are no "xmlns" attributes to remove when instantiating a new XElement. Rename file. Refactor: Owner property is no longer required. Address feedback regarding --repository option that should be in the following format: owner/repository. This makes it trivial to change repository url in a github actions scenario: gpr push your.nupkg --repository ${{ github.repository }} -k ${{ secrets.GITHUB_TOKEN }}. I have added additional test cases that verifies that we only rewrite nuspec if repository url, repository type or version has been changed. /cc @jcansdale Bugfix: Dispose nuspec context property. Only attempt to parse version if repository option has been set. Bugfix: Remove "_gpr.nupkg" prefix if nupkg is rewritten before uploading nupkg to GPR. Rename class to XElementExtensions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the way this is shaping out! If we could just check that either the .nupkg
contains a repository
element or the --repository
option is defined. That would catch a load of user error and make the --repository
option more discoverable. 😄
…ng the user to upload multiple packages simultaneously. Concurrency may be controlled via the optional "--concurrency" command.
… it's determined to be irrelevant (has no effect in the package upload process).
…om nupkg metadata. If value is invalid then inform user that they may override repository url using the --repository option.
@jcansdale I've adressed your feedback :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of nits/suggested changes. 👍
…and uploading multiple packages in parallel. Concurrency can be controlled by the "--concurrency" option. Fixes jcansdale#30
@jcansdale I merged #30 into this PR. I've also addressed your feedback. Much appreciated :) |
@peters it looks like we have a merge conflict. Can I leave that to you because I'll probably mess it up. 😉 |
# Conflicts: # src/GprTool/Program.cs
…l .nupkg, .snupkg files found in current working directory.
@peters I'm afraid I'm still seeing this:
I'm guessing you're using Windows. Is it doing this on that? |
I've fixed the, "Unable to find any packages in directory" error in 623bfce. It looks like we needed to use the a full path in the glob. |
…or expanding both relative and absolute glob patterns.
You are correct. I did some refactoring in order to handle both relative and absolute glob patterns in commit 04fd2b4 I've tested the following patterns on Windows. In the examples below, working directory is
Test cases are available here: https://github.com/jcansdale/gpr/blob/8fd11e62f311d385efe71715ece8bef8056f7520/test/GprTool.Tests/IoExtensionsTests.cs |
…:IsRunningTests=True
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great!
My last suggestion is to make the re-written package's extension .zip
. This would be a simple way to prevent re-written packages being picked up by subsequent publishes.
For example, this happened in one of my tests:
$ dotnet run --project src/GprTool/GprTool.csproj push publish/system.threading.threadpool/4.0.10 --repository jcansdale/packages
Found 4 packages.
[System.Threading.ThreadPool.4.0.10_79a787939afb425bad2ec43d523b7a35_gpr.nupkg]: Repository url: https://github.com/jcansdale/packages. Version: 4.0.10. Size: 87957 bytes.
[System.Threading.ThreadPool.4.0.10_8593de2577f6432e8ce0f86978d9fd21_gpr.nupkg]: Repository url: https://github.com/jcansdale/packages. Version: 4.0.10. Size: 87955 bytes.
[System.Threading.ThreadPool.4.0.10_b40597b284c04a70b02ed302b5381d4d_gpr.nupkg]: Repository url: https://github.com/jcansdale/packages. Version: 4.0.10. Size: 87955 bytes.
[System.Threading.ThreadPool.4.0.10_b40597b284c04a70b02ed302b5381d4d_gpr.nupkg]: Uploading package.
[System.Threading.ThreadPool.4.0.10_8593de2577f6432e8ce0f86978d9fd21_gpr.nupkg]: Uploading package.
[System.Threading.ThreadPool.4.0.10_79a787939afb425bad2ec43d523b7a35_gpr.nupkg]: Uploading package.
[System.Threading.ThreadPool.4.0.10.nupkg]: Repository url: https://github.com/jcansdale/packages. Version: 4.0.10. Size: 87958 bytes.
[System.Threading.ThreadPool.4.0.10.nupkg]: Uploading package.
[System.Threading.ThreadPool.4.0.10_79a787939afb425bad2ec43d523b7a35_gpr.nupkg]: Error: Version System.Threading.ThreadPool of "4.0.10" has already been pushed.
[System.Threading.ThreadPool.4.0.10_8593de2577f6432e8ce0f86978d9fd21_gpr.nupkg]: Error: Version System.Threading.ThreadPool of "4.0.10" has already been pushed.
[System.Threading.ThreadPool.4.0.10.nupkg]: Error: Version System.Threading.ThreadPool of "4.0.10" has already been pushed.
[System.Threading.ThreadPool.4.0.10_b40597b284c04a70b02ed302b5381d4d_gpr.nupkg]: Error: Version System.Threading.ThreadPool of "4.0.10" has already been pushed.
I've marked this PR as ✅ , so merge at will. Thanks for this excellent contribution! 😄
@jcansdale Build is green on Windows/Linux: https://github.com/peters/gpr/runs/778631740?check_suite_focus=true It would be useful if you could also add build badges: https://github.com/peters/gpr#gpr One final request would be to enable dependabot so that nuget dependencies are updated (PR) automatically on a daily schedule. Bonus: If you could enable prerelease versioning on PRs that would be awesome and it would be really easy to test new changes :) |
Co-authored-by: Jamie Cansdale <[email protected]>
…ng nupkg in order to avoid uploading previously written packages.
…s a glob pattern. Maybe also fixes jcansdale#57 ?
…sed on the underlying OS.
@jcansdale I updated the workflow file with OSX support. It should be as simple as copy-pasting the workflow file into this repository and we are good to go :) Test are green on Windows, OSX and Linux: https://github.com/peters/gpr/runs/778786424?check_suite_focus=true |
LGTM 👍 |
@peters It feels good to merge this PR! 🙏 🎈 👍 |
@jcansdale Awesome! Thanks for excellent feedback reviews :) |
Thanks, I merged it in #58 |
Just tried it out bulk uploading packages. This is pretty great and easy to use @peters |
Uploading a single
.nupkg
filegpr push your.nupkg -r ${{ github.repository }} -k ${{ secrets.GITHUB_TOKEN }}
gpr push your.nupkg your.snupkg -r ${{ github.repository }} -k ${{ secrets.GITHUB_TOKEN }}
Upload all
.nupkg
files in current working directorygpr push *.nupkg -r ${{ github.repository }} -k ${{ secrets.GITHUB_TOKEN }}
Upload all
.nupkg
files in current working directorygpr push *.nupkg -r ${{ github.repository }} -k ${{ secrets.GITHUB_TOKEN }}
Upload all
.nupkg
,.snupkg
files in current working directorygpr push . -r ${{ github.repository }} -k ${{ secrets.GITHUB_TOKEN }}
Upload recursively all
.nupkg
files found in current working directorygpr push **\**.nupkg -r ${{ github.repository }} -k ${{ secrets.GITHUB_TOKEN }}
Upload recursively all
.nupkg
,.snupkg
(symbol packages) files found in current working directorygpr push **\** -r ${{ github.repository }} -k ${{ secrets.GITHUB_TOKEN }}
Fixes #30
Fixes #47
Fixes #48
Fixes #50
/cc @jcansdale