# yaml-language-server: $schema=https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/github-action.json name: "publish-nuget" description: "Publishes a NuGet package to a Gitea-hosted NuGet registry and attests to its contents." inputs: package-name: description: "Name of the NuGet package, e.g. Oceanbox.FvcomKit." required: true nuget-key: description: "API key with which to authenticate to the NuGet registry." required: true nupkg-dir: description: | Directory in which to find the NuGet .nupkg file. We will search one level deep inside this directory for nupkg files named {package-name}.{any-string}.nupkg. Note that this action is not designed to work if you have two .nupkg files inside this directory, one called Foo.0.0.0.nupkg and one called Foo.Bar.0.0.0.nupkg; you should make sure there's only one package in this directory. required: true registry-url: description: "URL of the NuGet registry, e.g. https://git.oceanbox.io/api/packages/oceanbox/nuget/index.json" required: true default: "https://git.oceanbox.io/api/packages/oceanbox/nuget/index.json" source-name: description: "Name to use for the NuGet source when adding it." required: false default: "gitea-nuget" dotnet: description: "Path to the `dotnet` executable, if you want to override the default (e.g. because you wish to operate inside a Nix devshell)." required: false default: "dotnet" skip-duplicate: description: 'If set to "true", skips publishing if the package version already exists.' required: false default: "true" runs: using: "composite" steps: - name: Publish to NuGet Registry shell: bash id: publish-success env: NUGET_API_KEY: ${{ inputs.nuget-key }} PACKAGE_DIR: ${{ inputs.nupkg-dir }} PACKAGE_NAME: ${{ inputs.package-name }} DOTNET_EXE: ${{ inputs.dotnet }} REGISTRY_URL: ${{ inputs.registry-url }} SOURCE_NAME: ${{ inputs.source-name }} SKIP_DUPLICATE: ${{ inputs.skip-duplicate }} run: '$GITHUB_ACTION_PATH/nuget_push.sh "$PACKAGE_DIR"/"$PACKAGE_NAME".*.nupkg'