diff --git a/.github/workflows/dotnet-core.yml b/.github/workflows/dotnet-cicd.yml similarity index 73% rename from .github/workflows/dotnet-core.yml rename to .github/workflows/dotnet-cicd.yml index 80f014e..f3229ab 100644 --- a/.github/workflows/dotnet-core.yml +++ b/.github/workflows/dotnet-cicd.yml @@ -44,8 +44,9 @@ jobs: if: matrix.os == 'ubuntu-latest' uses: actions/upload-artifact@v7 with: - name: packages - path: artifacts/ + name: nuget-packages + path: artifacts/*.nupkg + retention-days: 2 if-no-files-found: error # Publishes the packages built above to nuget.org on v* tags, with a short-lived key from @@ -62,12 +63,13 @@ jobs: - name: Download packages uses: actions/download-artifact@v8 with: - name: packages + name: nuget-packages path: artifacts - - name: Check package versions match the tag + - name: Verify the package versions match the tag run: | version="${GITHUB_REF_NAME#v}" + echo "version: $version" for package in artifacts/*.nupkg; do case "$package" in *".$version.nupkg") ;; @@ -75,19 +77,22 @@ jobs: esac done - - name: Log in to nuget.org - id: login + - name: NuGet login (OIDC → temp API key) uses: NuGet/login@v1 + id: login with: - user: ${{ vars.NUGET_USER }} # the nuget.org profile name that owns the Trusted Publishing policy + user: ${{ secrets.NUGET_USER }} # the nuget.org profile name that owns the Trusted Publishing policy + # Use .NET 11 to get nuget staging support - uses: actions/setup-dotnet@v6 with: - dotnet-version: 10.0.x + dotnet-version: 11.0.x - - name: Push - run: > - dotnet nuget push "artifacts/*.nupkg" - --api-key "${{ steps.login.outputs.NUGET_API_KEY }}" - --source https://api.nuget.org/v3/index.json - --skip-duplicate \ No newline at end of file + - name: Push NuGet packages + run: | + for package in artifacts/*.nupkg; do + dotnet package stage push "$package" \ + --api-key "${{ steps.login.outputs.NUGET_API_KEY }}" \ + --group netcore-extensions \ + --source https://api.nuget.org/v3/index.json + done diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml deleted file mode 100644 index 9cfb349..0000000 --- a/.github/workflows/publish-nuget.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Publish NuGet Package - -on: - push: - tags: - - 'v*' - -jobs: - build-and-publish: - permissions: - id-token: write # enable GitHub OIDC token issuance for this job - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v7 - - - name: Setup .NET 10.0 - uses: actions/setup-dotnet@v6 - with: - dotnet-version: 10.0.* - - - name: Install dependencies - run: dotnet restore - - - name: Build - run: dotnet build --configuration Release --no-restore - - - name: Test - run: | - dotnet test --configuration Release --no-restore --verbosity normal ./Test.AMT.Extensions.System/Test.AMT.Extensions.System.csproj - dotnet test --configuration Release --no-restore --verbosity normal ./Test.AMT.Extensions.Linq/Test.AMT.Extensions.Linq.csproj - # NOTE: does not test /Test.AMT.Extensions.Logging at GitHub b/c fails w/IP port comms. - - - name: Pack - run: dotnet pack ./netcore-extensions.slnx --configuration Release --no-build --output artifacts - # building the slnx should build a package per csproj with IsPackable=true - - - # Get a short-lived NuGet API key - - name: NuGet login (OIDC → temp API key) - uses: NuGet/login@v1 - id: login - with: - user: ${{ secrets.NUGET_USER_NAME }} # nuget.org username (profile name), NOT your email address - - # Push the package - - name: NuGet push - run: | - dotnet nuget push artifacts/*.nupkg --api-key ${{steps.login.outputs.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json \ No newline at end of file