version: 0.94.0.{build}

os: Visual Studio 2017
image: Visual Studio 2017

environment:
  AppVeyor: APPVEYOR

init:

- ps: >-
    if ($env:APPVEYOR_REPO_TAG -eq 'true')
    {
      $env:fileVersion = $env:APPVEYOR_REPO_TAG_NAME -replace '(\d+)\.(\d+)\.(\d+)(-.+)?', '$1.$2.$3'
      if ($env:fileVersion -eq $env:APPVEYOR_REPO_TAG_NAME) { $env:fileVersion = $($env:fileVersion + '.0') }
      else { $env:fileVersion = $($env:fileVersion + '.' + $env:APPVEYOR_BUILD_NUMBER) }
      $env:productVersion = $env:APPVEYOR_REPO_TAG_NAME
    }
    else
    {
      $env:fileVersion = $env:APPVEYOR_BUILD_VERSION -replace '(\d+)\.(\d+)\.([^.]+)\.(\d+)', '$1.$2.999.$4'
      $env:productVersion = $env:fileVersion
    }
    
    Update-AppveyorBuild -Version $env:fileVersion
    
    Write-Host $env:fileVersion $env:productVersion
    
    Write-Host $env:APPVEYOR_REPO_TAG $env:APPVEYOR_REPO_TAG_NAME


dotnet_csproj:
  patch: true
  file: '**\*.csproj'
  version: '$(productVersion)'
  package_version: '$(productVersion)'
  assembly_version: '$(fileVersion)'
  file_version: '$(fileVersion)'
  informational_version: '$(productVersion)'

# platform: Any CPU
configuration : 
- Release
- Release.Signed

before_build:
  - cmd: nuget update -self
  - nuget restore

build:
  parallel: true
  project: ClosedXML.sln
  verbosity: minimal

artifacts:
  - path: ClosedXML/bin/%CONFIGURATION%/*/ClosedXML.dll
  - path: ClosedXML/bin/%CONFIGURATION%/*.nupkg

nuget:
  project_feed: true
  disable_publish_on_pr: true
