Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/publish-nuget.yml
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') }}

Copy link
Copy Markdown
Member

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-alpha1 version, it will trigger the workflow and produce v6.0.0-alpha1 NuGet packages.

Do you know if NuGet treats that as the latest version?

If it does, maybe startsWith isn't enough: we might need to check that the version matches exactly vX.Y.Z without extra characters 🤷

@supergibbs supergibbs Jul 2, 2025

Copy link
Copy Markdown
Contributor Author

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-alpha1 if viewing 5.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 -prerelease or 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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

When installing though, the default is the latest (by SemVer) that is not a prerelease version.

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.

I noticed NuGet is the only one that doesn't specify a version on the Package Managers section. Should 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 saying npm install bootstrap@5.3.7. We could do the same for NuGet, yes :)

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"
17 changes: 0 additions & 17 deletions nuget/MyGet.ps1

This file was deleted.

2 changes: 1 addition & 1 deletion nuget/bootstrap.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>bootstrap</id>
<!-- pulled from package.json -->
<!-- pulled from release tag -->
<version>5</version>
<title>Bootstrap CSS</title>
<authors>The Bootstrap Authors</authors>
Expand Down
2 changes: 1 addition & 1 deletion nuget/bootstrap.sass.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>bootstrap.sass</id>
<!-- pulled from package.json -->
<!-- pulled from release tag -->
<version>5</version>
<title>Bootstrap Sass</title>
<authors>The Bootstrap Authors</authors>
Expand Down