Skip to content

Commit 4bd8b6c

Browse files
supergibbsJesse Mandeljulien-deramond
authored
Migrate MyGet script to GH actions (#41583)
* Migrate MyGet script to GH actions to automatically build/publish the Bootstrap NuGet package when a release is created * Remove `-NoPackageAnalysis` flag * Use sha-1 for jobs --------- Co-authored-by: Jesse Mandel <[email protected]> Co-authored-by: Julien Déramond <[email protected]>
1 parent f50f38b commit 4bd8b6c

File tree

4 files changed

+33
-19
lines changed

4 files changed

+33
-19
lines changed

.github/workflows/publish-nuget.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Publish NuGet Packages
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
package-nuget:
9+
runs-on: windows-latest
10+
if: ${{ github.repository == 'twbs/bootstrap' && startsWith(github.event.release.tag_name, 'v') }}
11+
env:
12+
GITHUB_REF_NAME: ${{ github.ref_name }}
13+
steps:
14+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
15+
with:
16+
persist-credentials: false
17+
18+
- name: Set up NuGet
19+
uses: nuget/setup-nuget@323ab0502cd38fdc493335025a96c8fdb0edc71f # v2.0.1
20+
with:
21+
nuget-api-key: ${{ secrets.NuGetAPIKey }}
22+
nuget-version: '5.x'
23+
24+
- name: Pack NuGet packages
25+
shell: pwsh
26+
run: |
27+
$bsversion = $env:GITHUB_REF_NAME.Substring(1)
28+
nuget pack "nuget\bootstrap.nuspec" -Verbosity detailed -NonInteractive -BasePath . -Version $bsversion
29+
nuget pack "nuget\bootstrap.sass.nuspec" -Verbosity detailed -NonInteractive -BasePath . -Version $bsversion
30+
nuget push "bootstrap.$bsversion.nupkg" -Verbosity detailed -NonInteractive -Source "https://api.nuget.org/v3/index.json"
31+
nuget push "bootstrap.sass.$bsversion.nupkg" -Verbosity detailed -NonInteractive -Source "https://api.nuget.org/v3/index.json"

nuget/MyGet.ps1

Lines changed: 0 additions & 17 deletions
This file was deleted.

nuget/bootstrap.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
33
<metadata>
44
<id>bootstrap</id>
5-
<!-- pulled from package.json -->
5+
<!-- pulled from release tag -->
66
<version>5</version>
77
<title>Bootstrap CSS</title>
88
<authors>The Bootstrap Authors</authors>

nuget/bootstrap.sass.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
33
<metadata>
44
<id>bootstrap.sass</id>
5-
<!-- pulled from package.json -->
5+
<!-- pulled from release tag -->
66
<version>5</version>
77
<title>Bootstrap Sass</title>
88
<authors>The Bootstrap Authors</authors>

0 commit comments

Comments
 (0)