name: 'publish-nuget' description: 'Publishes a NuGet package.' inputs: api-key: description: 'The API key to use for publishing the package.' required: true package-name: description: 'The name of the NuGet package contains (contains check).' default: '' source-url: description: 'The URL of the NuGet server to publish to. Defaults to https://api.nuget.org/v3/index.json.' default: 'https://api.nuget.org/v3/index.json' runs: using: 'composite' steps: - name: Publish NuGet package(s) shell: bash run: | nugetFiles=$(find . -type f -name "*.nupkg") if [ -n "${{ inputs.package-name }}" ]; then nugetFiles=$(echo "$nugetFiles" | grep "${{ inputs.package-name }}") fi for nugetFile in $nugetFiles; do echo "Publishing package: $(basename "$nugetFile")" dotnet nuget push "$nugetFile" --api-key "${{ inputs.api-key }}" --source "${{ inputs.source-url }}" --skip-duplicate done