Publish a nuget package with optional restriction to a name
This commit is contained in:
30
lnx/publish-nuget/action.yml
Normal file
30
lnx/publish-nuget/action.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
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
|
||||
Reference in New Issue
Block a user