Skip to content
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

Automatically push the build to NuGet on a tagged release #2373

Merged
merged 3 commits into from
Feb 28, 2023

Conversation

JimBobSquarePants
Copy link
Member

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

Adds configuration to automatically push the build to NuGet on a tagged release.

Copy link

@SkyeHoefling SkyeHoefling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change makes a lot of sense to me. When I publish to multiple package feeds I typically set it up in separate tasks like this. Since you told me this is new for you I am going to explain what it looks like this does to me to ensure you got what you want.

  • The step Feedz Publish will always publish regardless of tasks when this build runs
  • The step NuGet Publish will only publish if you add a new tag, regardless of the tag name. This would include any Release Client or preview builds that may be numbered 1.0.0-rc1 or 1.0.0-preview-1.

I think this PR captures what we discussed on twitter and the description and should do what you are looking to do.

Additional Ideas

Some things that I do with this technique is tag any release including final releases and preview releases. I publish them to feeds slightly differently and need additional steps to build out the logic tree.

dotnet nuget push .\artifacts\*.nupkg -k ${{secrets.FEEDZ_TOKEN}} -s https://f.feedz.io/sixlabors/sixlabors/nuget/index.json
dotnet nuget push .\artifacts\*.snupkg -k ${{secrets.FEEDZ_TOKEN}} -s https://f.feedz.io/sixlabors/sixlabors/symbols
# TODO: If github.ref starts with 'refs/tags' then it was tag push and we can optionally push out package to nuget.org
run: dotnet nuget push .\artifacts\*.nupkg -k ${{secrets.FEEDZ_TOKEN}} -s https://f.feedz.io/sixlabors/sixlabors/nuget/index.json -ss https://f.feedz.io/sixlabors/sixlabors/symbols

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure this will publish twice now once for the push on main and one for the tag build. I'm not sure how MinVer resolves the version on the push on main build, but theres a chance your pipeline could fail because either the CI or the tag build has already published to Feedz and you are trying a second time with the same version.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MinVer is great and will actually produce 2 different tags.

  1. A minor for main
  2. The tag value for the tag build.

@JimBobSquarePants
Copy link
Member Author

OK. I'm gonna give this a pop.

@JimBobSquarePants JimBobSquarePants merged commit 215c609 into main Feb 28, 2023
@JimBobSquarePants JimBobSquarePants deleted the js/publish-config branch February 28, 2023 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants