Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -62,32 +63,36 @@ 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") ;;
*) echo "::error::$package does not match tag version $version"; exit 1 ;;
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
- 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
50 changes: 0 additions & 50 deletions .github/workflows/publish-nuget.yml

This file was deleted.