Last active
October 19, 2016 12:10
-
-
Save george-polevoy/4b1c021303bb880076a7 to your computer and use it in GitHub Desktop.
Publishing a .NET project with Appveyor and NuGet. appveyor.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Summary of settings for [Publishing a .NET project with Appveyor and NuGet](http://few-lines-of-code.blogspot.com/2016/03/publishing-net-project-with-appveyor.html) tutorial. | |
version: debug_01.{branch}_{build} | |
pull_requests: | |
do_not_increment_build_number: true | |
branches: | |
only: | |
- /release\/.*/ | |
skip_tags: true | |
configuration: Release | |
platform: Any CPU | |
init: | |
- ps: >- | |
$ErrorActionPreference='Stop'; | |
$branch = $env:APPVEYOR_REPO_BRANCH; | |
$buildNumber = $env:APPVEYOR_BUILD_NUMBER; | |
$num = '(0|[1-9]{1}[0-9]{0,})'; | |
$rx = "^[a-z\-]+/v(?'ver'$num\.$num\.$num)(-(?'preSpec'[a-zA-Z]{1,}[0-9]{0,})){0,1}$"; | |
$match = [regex]::match($branch, $rx); | |
if (!$match.Success) | |
{ | |
throw "Branch name is not correct semver (1.0.0): " + $branch; | |
} | |
$version = $match.Groups['ver'].Value; | |
$preReleaseSpec = $match.Groups['preSpec'].Value; | |
$assemblyVersion = $version + ".0"; | |
$fileVersion = $version + "." + $buildNumber; | |
$informationalVersion = $version; | |
if ("" -eq $preReleaseSpec) | |
{ | |
$informationalVersion = $version + "." + $buildNumber; | |
} | |
else | |
{ | |
$informationalVersion = $version + "-" + $preReleaseSpec + "-" + $buildNumber.PadLeft(6,'0'); | |
} | |
$env:release_AssemblyVersion = $assemblyVersion; | |
$env:release_FileVersion = $fileVersion; | |
$env:release_InformationalVersion = $informationalVersion; | |
Write-Output "Versioning for a nuget release" | |
Write-Output "env:release_AssemblyVersion = $assemblyVersion" | |
Write-Output "env:release_FileVersion = $fileVersion" | |
Write-Output "env:release_InformationalVersion = $informationalVersion" | |
$displayVersion = "debug 01 " + $informationalVersion | |
Update-AppveyorBuild -Version $displayVersion | |
assembly_info: | |
patch: true | |
file: '**\AssemblyInfo.*' | |
assembly_version: $(release_AssemblyVersion) | |
assembly_file_version: $(release_FileVersion) | |
assembly_informational_version: $(release_InformationalVersion) | |
before_build: | |
- ps: nuget restore | |
build: | |
publish_nuget: true | |
publish_nuget_symbols: true | |
verbosity: normal | |
deploy: | |
- provider: NuGet | |
api_key: | |
secure: ******** | |
on: | |
branch: /release\/.*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This gist is a summary of settings used in the Publishing a .NET project with Appveyor and NuGet tutorial, exported as a YAML file.