1.0.0 • Published 1 year ago

@ifaxity/semantic-release-nuget v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@ifaxity/semantic-release-nuget

semantic-release plugin to package and publish a package via NuGet using the dotnet-cli.

Codacy grade npm (scoped) npm bundle size (scoped) npm bundle size (scoped)

StepDescription
verifyConditionsVerify that the dotnet-cli is installed and prints its nuget version.
prepareExecutes dotnet pack which creates a nupkg file from the targeted project.
publishExecutes dotnet nuget push which publishes nupkg files to a specified NuGet server.

Install

$ npm i --save-dev @ifaxity/semantic-release-nuget

Usage

The plugin can be configured in the semantic-release configuration file:

{
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    "@ifaxity/semantic-release-dotnet",
    ["@ifaxity/semantic-release-nuget", {
      "apiKey": "abc...",
      "source": "https://api.nuget.org/v3/index.json"
    }]
  ]
}

With this example:

  • The project will be built and versioned by the plugin @ifaxity/semantic-release-dotnet
  • The package will be prepared by @ifaxity/semantic-release-nuget
  • The package will be published by @ifaxity/semantic-release-nuget

Note: it's recommended to include @ifaxity/semantic-release-dotnet directly before this plugin or some other custom way.

Configuration

Nuget registry authentication

The Nuget authentication configuration is required and can be set via environment variables or via options.

Notes:

  • Both source and apiKey is required. Either implicitly from environment variables or explicitly in the configuration.

Environment variables

VariableDescription
NUGET_API_KEYNuget API Key, (to create one for nuget.org go to https://www.nuget.org/account/apikeys).
NUGET_SOURCENuget source url (for nuget.org this is https://api.nuget.org/v3/index.json).
NUGET_ASSETAsset to push to Nuget, supports glob patterns so *.nupkg publishes all the packages in cwd.
PACK_PROJECTProject to pack, should be an absolute reference to a csproj file or a directory.
PACK_CONFIGURATIONSets the configuration when building the project (only works if option build: true is set).
PACK_OUTPUTSets the output directory of the nuget pack command. Defaults to cwd.

Options

project

The project or solution to pack. It's either a path to a csproj, vbproj, or fsproj file, or to a solution file or directory. If not specified, the command searches the current directory for a project or solution file.

configuration

Defines the build configuration. The default for most projects is Debug, but you can override the build configuration settings in your project.

build

Doesn't build the project before packing. It also implicitly sets the --no-restore flag.

output

Places the built packages in the directory specified.

includeSource

Includes the debug symbols NuGet packages in addition to the regular NuGet packages in the output directory. The sources files are included in the src folder within the symbols package.

includeSymbols

Includes the debug symbols NuGet packages in addition to the regular NuGet packages in the output directory.

dependencies

Ignores project-to-project references and only restores the root project.

properties

MSBuild properties to override when packaging the project. See the MSBuild properties reference for a list of properties that can be set.

restore

Doesn't execute an implicit restore when running the command.

force

Forces all dependencies to be resolved even if the last restore was successful. Specifying this flag is the same as deleting the project.assets.json file.

runtime

Specifies the target runtime to restore packages for. For a list of Runtime Identifiers (RIDs), see the RID catalog.

packArguments

Generic pack arguments to send, can be used if there is a specific option that needs to be configured that is not in the config above.

asset

Specifies the file path to the package to be pushed.

apiKey

The API key for the server. If not explicitly set, the value from the environment variable NUGET_API_KEY is used instead.

source

Specifies the server URL. NuGet identifies a UNC or local folder source and simply copies the file there instead of pushing it using HTTP. If not explicitly set, the value from the environment variable NUGET_SOURCE is used instead.

skipDuplicate

When pushing multiple packages to an HTTP(S) server, treats any 409 Conflict response as a warning so that other pushes can continue.

timeout

Specifies the timeout for pushing to a server in seconds. Defaults to 300 seconds (5 minutes). Specifying 0 applies the default value.

pushArguments

Generic push arguments to send, can be used if there is a specific option that needs to be configured that is not in the config above.

License

MIT