From 4f31720fbba0a830d0ecab436bd764ddbd7e5057 Mon Sep 17 00:00:00 2001 From: Jesse Mandel Date: Mon, 30 Jun 2025 16:14:59 -0700 Subject: [PATCH 1/3] Migrate MyGet script to GH actions to automatically build/publish the Bootstrap NuGet package when a release is created --- .github/workflows/publish-nuget.yml | 31 +++++++++++++++++++++++++++++ nuget/MyGet.ps1 | 17 ---------------- 2 files changed, 31 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/publish-nuget.yml delete mode 100644 nuget/MyGet.ps1 diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml new file mode 100644 index 000000000000..cdc2268cf17a --- /dev/null +++ b/.github/workflows/publish-nuget.yml @@ -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@v4 + with: + persist-credentials: false + + - name: Set up NuGet + uses: nuget/setup-nuget@v2 + 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 -NoPackageAnalysis -BasePath . -Version $bsversion + nuget pack "nuget\bootstrap.sass.nuspec" -Verbosity detailed -NonInteractive -NoPackageAnalysis -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" diff --git a/nuget/MyGet.ps1 b/nuget/MyGet.ps1 deleted file mode 100644 index 5213b0104ed2..000000000000 --- a/nuget/MyGet.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -# set env vars usually set by MyGet (enable for local testing) -#$env:SourcesPath = '..' -#$env:NuGet = "./nuget.exe" # https://dist.nuget.org/win-x86-commandline/latest/nuget.exe - -$nuget = $env:NuGet - -# parse the version number out of package.json -$bsversionParts = ((Get-Content $env:SourcesPath\package.json) -join "`n" | ConvertFrom-Json).version.split('-', 2) # split the version on the '-' -$bsversion = $bsversionParts[0] - -if ($bsversionParts.Length -gt 1) { - $bsversion += '-' + $bsversionParts[1].replace('.', '').replace('-', '_') # strip out invalid chars from the PreRelease part -} - -# create packages -& $nuget pack "$env:SourcesPath\nuget\bootstrap.nuspec" -Verbosity detailed -NonInteractive -NoPackageAnalysis -BasePath $env:SourcesPath -Version $bsversion -& $nuget pack "$env:SourcesPath\nuget\bootstrap.sass.nuspec" -Verbosity detailed -NonInteractive -NoPackageAnalysis -BasePath $env:SourcesPath -Version $bsversion From 14307750036d7227e3f5e096ba4e557aef5f45d4 Mon Sep 17 00:00:00 2001 From: Jesse Mandel Date: Thu, 3 Jul 2025 08:22:46 -0700 Subject: [PATCH 2/3] Remove `-NoPackageAnalysis` flag --- .github/workflows/publish-nuget.yml | 4 ++-- nuget/bootstrap.nuspec | 2 +- nuget/bootstrap.sass.nuspec | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml index cdc2268cf17a..8b306cce125f 100644 --- a/.github/workflows/publish-nuget.yml +++ b/.github/workflows/publish-nuget.yml @@ -25,7 +25,7 @@ jobs: shell: pwsh run: | $bsversion = $env:GITHUB_REF_NAME.Substring(1) - nuget pack "nuget\bootstrap.nuspec" -Verbosity detailed -NonInteractive -NoPackageAnalysis -BasePath . -Version $bsversion - nuget pack "nuget\bootstrap.sass.nuspec" -Verbosity detailed -NonInteractive -NoPackageAnalysis -BasePath . -Version $bsversion + 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" diff --git a/nuget/bootstrap.nuspec b/nuget/bootstrap.nuspec index 073655342515..a2f0de96cfe2 100644 --- a/nuget/bootstrap.nuspec +++ b/nuget/bootstrap.nuspec @@ -2,7 +2,7 @@ bootstrap - + 5 Bootstrap CSS The Bootstrap Authors diff --git a/nuget/bootstrap.sass.nuspec b/nuget/bootstrap.sass.nuspec index 20fbdaa79a50..cd08cd495bec 100644 --- a/nuget/bootstrap.sass.nuspec +++ b/nuget/bootstrap.sass.nuspec @@ -2,7 +2,7 @@ bootstrap.sass - + 5 Bootstrap Sass The Bootstrap Authors From db20097556992eb057a52e36c44159bc048e0571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20D=C3=A9ramond?= Date: Tue, 5 Aug 2025 20:47:49 +0200 Subject: [PATCH 3/3] Use sha-1 for jobs --- .github/workflows/publish-nuget.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml index 8b306cce125f..23af174ab68a 100644 --- a/.github/workflows/publish-nuget.yml +++ b/.github/workflows/publish-nuget.yml @@ -11,12 +11,12 @@ jobs: env: GITHUB_REF_NAME: ${{ github.ref_name }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false - name: Set up NuGet - uses: nuget/setup-nuget@v2 + uses: nuget/setup-nuget@323ab0502cd38fdc493335025a96c8fdb0edc71f # v2.0.1 with: nuget-api-key: ${{ secrets.NuGetAPIKey }} nuget-version: '5.x'