Build and release pipeline for NuGet packages
Default options
options: {
projectFiles: [ '*.sln' ],
testFiles: [ 'tests/**/*.csproj' ],
nugetSrc: 'src/**/*.csproj',
nugetDest: 'artifacts/',
msbuild: {
projectConfiguration: 'Release',
targets: [ 'Clean', 'Rebuild' ],
stdout: true,
buildParameters: {
WarningLevel: 2
},
verbosity: 'quiet'
},
nunit: {
framework: 'net-4.5.2',
path: path.join(root + './bin/NUnit.Runners.2.6.4')
},
fingerprint: {
updateConfigs: ['fingerprint']
},
nugetpack: {
}
}
Usage
npm install -D grunt-nuget-pipeline
Gruntfile.js
module.exports = function(grunt) {
grunt.config.init();
grunt.loadNpmTasks('grunt-nuget-pipeline');
}
NuGet flow
The pipeline goes through following stages:
- build: runs the following steps:
- tag: determines the environment (fingerprint) and version (setversion) (from package.json) and stores them in grunt.config
- compile: populates version to src/AssemblyVersionInfo.cs (setversion) and runs msbuild on *.sln
- test: runs nunit on tests/**/*.csproj
- pack: runs nugetpack on src/**/*.csproj and stores results in artifacts/
- release: runs nugetpush
You can invoke the whole pipeline by using
grunt nuget
Versioning
The nuget package version and dll assembly version is inferred from package.json. To change version you can use grunt-bump
grunt bump
This will increment the version appropriately and commit/push the change into repository and tags the release.