From ac09bc25888a95e5bab3c5bba451aa324493b06d Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Sun, 15 Nov 2026 01:53:58 +0800 Subject: [PATCH 1/2] Use trusted publishing for NuGet packages --- .github/workflows/Nuget.yml | 49 ++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/.github/workflows/Nuget.yml b/.github/workflows/Nuget.yml index 13782a473..bb1269a34 100644 --- a/.github/workflows/Nuget.yml +++ b/.github/workflows/Nuget.yml @@ -9,6 +9,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read + id-token: write steps: - name: Setup .NET 10 uses: actions/setup-dotnet@v5 @@ -45,38 +46,62 @@ jobs: # Four numbers: the version without its prerelease or build suffix, and a zero. echo "file_version=${version%%[-+]*}.0" >> $GITHUB_OUTPUT - - name: 'Pack and publish AngouriMath' + - name: 'Pack AngouriMath' run: | cd Sources/AngouriMath dotnet restore AngouriMath.csproj dotnet build AngouriMath.csproj -c release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }} dotnet pack AngouriMath.csproj -c release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }} - cd bin/release - dotnet nuget push AngouriMath.${{ steps.version.outputs.version }}.nupkg --api-key ${{ secrets.NUGET_KEY }} --source nuget.org + - name: 'NuGet login for AngouriMath' + id: login-angourimath + uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0 + with: + user: Happypig375 + + - name: 'Publish AngouriMath' + run: dotnet nuget push Sources/AngouriMath/bin/release/AngouriMath.${{ steps.version.outputs.version }}.nupkg --api-key "${{ steps.login-angourimath.outputs.NUGET_API_KEY }}" --source nuget.org - - name: 'Pack and publish AngouriMath.FSharp' + - name: 'Pack AngouriMath.FSharp' run: | cd Sources/Wrappers/AngouriMath.FSharp dotnet restore dotnet build -c Release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }} dotnet pack -c Release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }} - cd bin/Release - dotnet nuget push AngouriMath.FSharp.${{ steps.version.outputs.version }}.nupkg --api-key ${{ secrets.NUGET_KEY }} --source nuget.org + - name: 'NuGet login for AngouriMath.FSharp' + id: login-fsharp + uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0 + with: + user: Happypig375 + + - name: 'Publish AngouriMath.FSharp' + run: dotnet nuget push Sources/Wrappers/AngouriMath.FSharp/bin/Release/AngouriMath.FSharp.${{ steps.version.outputs.version }}.nupkg --api-key "${{ steps.login-fsharp.outputs.NUGET_API_KEY }}" --source nuget.org - - name: 'Pack and publish AngouriMath.Interactive' + - name: 'Pack AngouriMath.Interactive' run: | cd Sources/Wrappers/AngouriMath.Interactive dotnet restore dotnet build -c Release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }} dotnet pack -c Release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }} - cd bin/Release - dotnet nuget push AngouriMath.Interactive.${{ steps.version.outputs.version }}.nupkg --api-key ${{ secrets.NUGET_KEY }} --source nuget.org + - name: 'NuGet login for AngouriMath.Interactive' + id: login-interactive + uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0 + with: + user: Happypig375 + + - name: 'Publish AngouriMath.Interactive' + run: dotnet nuget push Sources/Wrappers/AngouriMath.Interactive/bin/Release/AngouriMath.Interactive.${{ steps.version.outputs.version }}.nupkg --api-key "${{ steps.login-interactive.outputs.NUGET_API_KEY }}" --source nuget.org - - name: 'Pack and publish AngouriMath.Terminal' + - name: 'Pack AngouriMath.Terminal' run: | cd Sources/Terminal/AngouriMath.Terminal dotnet restore dotnet build -c Release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }} dotnet pack -c Release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }} - cd bin/Release - dotnet nuget push AngouriMath.Terminal.${{ steps.version.outputs.version }}.nupkg --api-key ${{ secrets.NUGET_KEY }} --source nuget.org + - name: 'NuGet login for AngouriMath.Terminal' + id: login-terminal + uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0 + with: + user: Happypig375 + + - name: 'Publish AngouriMath.Terminal' + run: dotnet nuget push Sources/Terminal/AngouriMath.Terminal/bin/Release/AngouriMath.Terminal.${{ steps.version.outputs.version }}.nupkg --api-key "${{ steps.login-terminal.outputs.NUGET_API_KEY }}" --source nuget.org From dfb819d2555d2d32d3e8e3bda00dffa2062c0cc2 Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Sun, 15 Nov 2026 02:36:48 +0800 Subject: [PATCH 2/2] Reuse one NuGet login for all packages --- .github/workflows/Nuget.yml | 40 ++++++++++++------------------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/.github/workflows/Nuget.yml b/.github/workflows/Nuget.yml index bb1269a34..b11282c18 100644 --- a/.github/workflows/Nuget.yml +++ b/.github/workflows/Nuget.yml @@ -52,56 +52,42 @@ jobs: dotnet restore AngouriMath.csproj dotnet build AngouriMath.csproj -c release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }} dotnet pack AngouriMath.csproj -c release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }} - - name: 'NuGet login for AngouriMath' - id: login-angourimath - uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0 - with: - user: Happypig375 - - name: 'Publish AngouriMath' - run: dotnet nuget push Sources/AngouriMath/bin/release/AngouriMath.${{ steps.version.outputs.version }}.nupkg --api-key "${{ steps.login-angourimath.outputs.NUGET_API_KEY }}" --source nuget.org - - name: 'Pack AngouriMath.FSharp' run: | cd Sources/Wrappers/AngouriMath.FSharp dotnet restore dotnet build -c Release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }} dotnet pack -c Release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }} - - name: 'NuGet login for AngouriMath.FSharp' - id: login-fsharp - uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0 - with: - user: Happypig375 - - name: 'Publish AngouriMath.FSharp' - run: dotnet nuget push Sources/Wrappers/AngouriMath.FSharp/bin/Release/AngouriMath.FSharp.${{ steps.version.outputs.version }}.nupkg --api-key "${{ steps.login-fsharp.outputs.NUGET_API_KEY }}" --source nuget.org - - name: 'Pack AngouriMath.Interactive' run: | cd Sources/Wrappers/AngouriMath.Interactive dotnet restore dotnet build -c Release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }} dotnet pack -c Release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }} - - name: 'NuGet login for AngouriMath.Interactive' - id: login-interactive - uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0 - with: - user: Happypig375 - - name: 'Publish AngouriMath.Interactive' - run: dotnet nuget push Sources/Wrappers/AngouriMath.Interactive/bin/Release/AngouriMath.Interactive.${{ steps.version.outputs.version }}.nupkg --api-key "${{ steps.login-interactive.outputs.NUGET_API_KEY }}" --source nuget.org - - name: 'Pack AngouriMath.Terminal' run: | cd Sources/Terminal/AngouriMath.Terminal dotnet restore dotnet build -c Release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }} dotnet pack -c Release -p:Version=${{ steps.version.outputs.version }} -p:FileVersion=${{ steps.version.outputs.file_version }} - - name: 'NuGet login for AngouriMath.Terminal' - id: login-terminal + + - name: 'NuGet login' + id: login uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0 with: user: Happypig375 + - name: 'Publish AngouriMath' + 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 + + - name: 'Publish AngouriMath.FSharp' + 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 + + - name: 'Publish AngouriMath.Interactive' + 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 + - name: 'Publish AngouriMath.Terminal' - run: dotnet nuget push Sources/Terminal/AngouriMath.Terminal/bin/Release/AngouriMath.Terminal.${{ steps.version.outputs.version }}.nupkg --api-key "${{ steps.login-terminal.outputs.NUGET_API_KEY }}" --source nuget.org + 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