version: 0.104.0.{build}

image: Visual Studio 2022

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

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
  - path: ClosedXML/bin/%CONFIGURATION%/*.snupkg

nuget:
  project_feed: true
  disable_publish_on_pr: true
