From 5292485b297810978d4539851c59d9e806b4b121 Mon Sep 17 00:00:00 2001 From: vivet Date: Wed, 11 Nov 2026 14:36:38 +0100 Subject: [PATCH] Changed to Trusted publishing for NuGet --- .github/workflows/build-and-deploy.yml | 13 ++++++++++--- DanishCvr/DanishCvr.csproj | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index d9885cd..688c338 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -8,14 +8,14 @@ on: - master env: APP_NAME: DanishCvr - VERSION: 1.0.0 + VERSION: 1.0.1 NUGET_HOST: https://api.nuget.org/v3/index.json - NUGET_APIKEY: ${{ secrets.NUGET_APIKEY }} jobs: build-and-deploy: runs-on: ubuntu-latest permissions: contents: write + id-token: write concurrency: group: ${{ github.repository }} cancel-in-progress: true @@ -37,11 +37,18 @@ jobs: throw "Pack failed"; }; + - name: NuGet Login (Trusted Publishing) + if: github.ref == 'refs/heads/master' + id: nuget-login + uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0 + with: + user: vivet + - name: Push NuGet if: github.ref == 'refs/heads/master' shell: pwsh run: | - dotnet nuget push "nupkgs/*.nupkg" -s $env:NUGET_HOST -k $env:NUGET_APIKEY --skip-duplicate + dotnet nuget push "nupkgs/*.nupkg" -s $env:NUGET_HOST -k ${{ steps.nuget-login.outputs.NUGET_API_KEY }} --skip-duplicate if ($LastExitCode -ne 0) { diff --git a/DanishCvr/DanishCvr.csproj b/DanishCvr/DanishCvr.csproj index 408021f..6caff67 100644 --- a/DanishCvr/DanishCvr.csproj +++ b/DanishCvr/DanishCvr.csproj @@ -23,7 +23,7 @@ Look up Danish companies, production units and persons in the Central Business Register (CVR). Search and retrieve company, production unit, person and relation information from the Danish Central Business Register (CVR), including status, business type, industry, employment, addresses and ownership. Includes a batch service for exporting the full register. - - Initial Release + - Changed to Trusted publishing for NuGet Github master