Skip to content

Commit fbbce18

Browse files
authored
Use NuGet trusted publishing for release packages (#2444)
* Use trusted publishing for NuGet packages * Reuse one NuGet login for all packages
1 parent 2d5b90a commit fbbce18

1 file changed

Lines changed: 26 additions & 15 deletions

File tree

‎.github/workflows/Nuget.yml‎

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
permissions:
1111
contents: read
12+
id-token: write
1213
steps:
1314
- name: Setup .NET 10
1415
uses: actions/setup-dotnet@v5
@@ -45,38 +46,48 @@ jobs:
4546
# Four numbers: the version without its prerelease or build suffix, and a zero.
4647
echo "file_version=${version%%[-+]*}.0" >> $GITHUB_OUTPUT
4748
48-
- name: 'Pack and publish AngouriMath'
49+
- name: 'Pack AngouriMath'
4950
run: |
5051
cd Sources/AngouriMath
5152
dotnet restore AngouriMath.csproj
5253
dotnet build AngouriMath.csproj -c release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }}
5354
dotnet pack AngouriMath.csproj -c release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }}
54-
cd bin/release
55-
dotnet nuget push AngouriMath.${{ steps.version.outputs.version }}.nupkg --api-key ${{ secrets.NUGET_KEY }} --source nuget.org
56-
57-
- name: 'Pack and publish AngouriMath.FSharp'
55+
56+
- name: 'Pack AngouriMath.FSharp'
5857
run: |
5958
cd Sources/Wrappers/AngouriMath.FSharp
6059
dotnet restore
6160
dotnet build -c Release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }}
6261
dotnet pack -c Release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }}
63-
cd bin/Release
64-
dotnet nuget push AngouriMath.FSharp.${{ steps.version.outputs.version }}.nupkg --api-key ${{ secrets.NUGET_KEY }} --source nuget.org
65-
66-
- name: 'Pack and publish AngouriMath.Interactive'
62+
63+
- name: 'Pack AngouriMath.Interactive'
6764
run: |
6865
cd Sources/Wrappers/AngouriMath.Interactive
6966
dotnet restore
7067
dotnet build -c Release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }}
7168
dotnet pack -c Release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }}
72-
cd bin/Release
73-
dotnet nuget push AngouriMath.Interactive.${{ steps.version.outputs.version }}.nupkg --api-key ${{ secrets.NUGET_KEY }} --source nuget.org
74-
75-
- name: 'Pack and publish AngouriMath.Terminal'
69+
70+
- name: 'Pack AngouriMath.Terminal'
7671
run: |
7772
cd Sources/Terminal/AngouriMath.Terminal
7873
dotnet restore
7974
dotnet build -c Release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }}
8075
dotnet pack -c Release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }}
81-
cd bin/Release
82-
dotnet nuget push AngouriMath.Terminal.${{ steps.version.outputs.version }}.nupkg --api-key ${{ secrets.NUGET_KEY }} --source nuget.org
76+
77+
- name: 'NuGet login'
78+
id: login
79+
uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0
80+
with:
81+
user: Happypig375
82+
83+
- name: 'Publish AngouriMath'
84+
run: dotnet nuget push Sources/AngouriMath/bin/release/AngouriMath.${{ steps.version.outputs.version }}.nupkg --api-key "${{ steps.login.outputs.NUGET_API_KEY }}" --source nuget.org
85+
86+
- name: 'Publish AngouriMath.FSharp'
87+
run: dotnet nuget push Sources/Wrappers/AngouriMath.FSharp/bin/Release/AngouriMath.FSharp.${{ steps.version.outputs.version }}.nupkg --api-key "${{ steps.login.outputs.NUGET_API_KEY }}" --source nuget.org
88+
89+
- name: 'Publish AngouriMath.Interactive'
90+
run: dotnet nuget push Sources/Wrappers/AngouriMath.Interactive/bin/Release/AngouriMath.Interactive.${{ steps.version.outputs.version }}.nupkg --api-key "${{ steps.login.outputs.NUGET_API_KEY }}" --source nuget.org
91+
92+
- name: 'Publish AngouriMath.Terminal'
93+
run: dotnet nuget push Sources/Terminal/AngouriMath.Terminal/bin/Release/AngouriMath.Terminal.${{ steps.version.outputs.version }}.nupkg --api-key "${{ steps.login.outputs.NUGET_API_KEY }}" --source nuget.org

0 commit comments

Comments
 (0)