-
-
Notifications
You must be signed in to change notification settings - Fork 78.7k
Migrate MyGet script to GH actions #41583
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name: Publish NuGet Packages | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| jobs: | ||
| package-nuget: | ||
| runs-on: windows-latest | ||
| if: ${{ github.repository == 'twbs/bootstrap' && startsWith(github.event.release.tag_name, 'v') }} | ||
| env: | ||
| GITHUB_REF_NAME: ${{ github.ref_name }} | ||
| steps: | ||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up NuGet | ||
| uses: nuget/setup-nuget@323ab0502cd38fdc493335025a96c8fdb0edc71f # v2.0.1 | ||
| with: | ||
| nuget-api-key: ${{ secrets.NuGetAPIKey }} | ||
| nuget-version: '5.x' | ||
|
|
||
| - name: Pack NuGet packages | ||
| shell: pwsh | ||
| run: | | ||
| $bsversion = $env:GITHUB_REF_NAME.Substring(1) | ||
| nuget pack "nuget\bootstrap.nuspec" -Verbosity detailed -NonInteractive -BasePath . -Version $bsversion | ||
| nuget pack "nuget\bootstrap.sass.nuspec" -Verbosity detailed -NonInteractive -BasePath . -Version $bsversion | ||
| nuget push "bootstrap.$bsversion.nupkg" -Verbosity detailed -NonInteractive -Source "https://api.nuget.org/v3/index.json" | ||
| nuget push "bootstrap.sass.$bsversion.nupkg" -Verbosity detailed -NonInteractive -Source "https://api.nuget.org/v3/index.json" | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'm not exactly sure how NuGet versioning works, so I wanted to mention this. If we create a
v6.0.0-alpha1version, it will trigger the workflow and producev6.0.0-alpha1NuGet packages.Do you know if NuGet treats that as the latest version?
If it does, maybe
startsWithisn't enough: we might need to check that the version matches exactlyvX.Y.Zwithout extra characters 🤷Uh oh!
There was an error while loading. Please reload this page.
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.
Technically it does, in the sense when browsing nuget.org it will let you know there is newer version
6.0.0-alpha1if viewing5.3.7. Example, here is the latest stable EntityFrameworkCore and there is a message about a newer one that is prerelease (10.0.0-preview.5.25277.114).When installing though, the default is the latest (by SemVer) that is not a prerelease version. You can get the latest, including prerelease by adding
-prereleaseor a specific-version 5.3.7.I noticed NuGet is the only one that doesn't specify a version on the Package Managers section. Should it?
Regarding better version tag validation, I am all for it but don't want to exclude prereleases since we've supported them in the past.
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.
NuGet is smarter than npm then 😄 From what I remember, in npm, you have to be explicit if you don’t want a version to be tagged as latest, even if it’s a pre-release like
2.0.0-beta.1. npm doesn’t care about the version name; it uses the latest tag by default unless you override it.When running
npm install bootstrap, you get the latest (so currently the 5.3.7) and still we're specifying the version in the docs by sayingnpm install bootstrap@5.3.7. We could do the same for NuGet, yes :)