NuGet supports API key option

You can now use the --api-key command line option for publishing NuGet packages. This change allows you to pass your authentication token directly instead of storing it in the nuget.config file. This feature is available for all plans.

    steps:
    - name: Publish
      run: |
        dotnet nuget push "*.nupkg" \
          --api-key ${{ secrets.GITHUB_TOKEN }} \
          --source https://nuget.pkg.github.com/${{ github.repository_owner }}

Learn more about NuGet and GitHub Packages.