<commit_before>trigger:
  branches:
    include:
    - master
    - develop
    - release/*
    - refs/tags/*
  paths:
    exclude:
    - CHANGELOG.md
    - /*.md
    - .gitignore

pr:
  branches:
    include:
    - master
    - develop
    - release/*
  autoCancel: true

# add nf-tools repo to resources (for Azure Pipelines templates)
resources:
  repositories:
    - repository: templates
      type: github
      name: nanoframework/nf-tools
      endpoint: nanoframework

variables:
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

jobs:

###############################################
# build
- job: Build_NETMF

  pool:
    vmImage: 'vs2015-win2012r2'

  variables:
    solution: 'source/Json.NetMF.sln'
    buildPlatform: 'Any CPU'
    buildConfiguration: 'Release'

  steps:

  - checkout: self

  - script: |
      git config --global user.email "<EMAIL>"
      git config --global user.name "nfbot"
    displayName: Setup git identity

  - task: PowerShell@2
    inputs:
      targetType: 'inline'
      script: |
          Write-Output "Installing .NET MicroFramework 4.3 ..."

          $msiPath = "$($env:USERPROFILE)\MicroFrameworkSDK43.MSI"

          (New-Object Net.WebClient).DownloadFile('https://github.com/Azure/amqpnetlite/releases/download/netmf4.3/MicroFrameworkSDK4.3.MSI', $msiPath)

          & msiexec.exe /i $msiPath /quiet /log $env:USERPROFILE\netmf43.log | Write-Output

          Write-Output "NETMF43 Installed"

          Write-Output "Installing .NET MicroFramework 4.4 ..."

          $msiPath = "$($env:USERPROFILE)\MicroFrameworkSDK44.MSI"

          (New-Object Net.WebClient).DownloadFile('https://github.com/NETMF/netmf-interpreter/releases/download/v4.4-RTW-20-Oct-2015/MicroFrameworkSDK.MSI', $msiPath)

          & msiexec.exe /i $msiPath /quiet /log $env:USERPROFILE\netmf44.log | Write-Output

          Write-Output "NETMF44 Installed"

    displayName: Install .NETMF SDKs

  - task: NuGetToolInstaller@0

  - task: NuGetCommand@2
    inputs:
      restoreSolution: '$(solution)'
      feedsToUse: config
      nugetConfigPath: source/NuGet.config
    displayName: NuGet restore

  - task: VSBuild@1
    inputs:
      solution: '$(solution)'
      platform: '$(buildPlatform)'
      msbuildArgs: '/p:PublicRelease=true'
      configuration: '$(buildConfiguration)'

  - task: PowerShell@2
    inputs:
        targetType: 'inline'
        script: |
            $MyNuGetVersion = $env:NBGV_NuGetPackageVersion -replace "\-g$env:NBGV_GitCommitIdShort", ""

            # replace preview with alpha if this is a PR build
            if($env:Build_Reason -eq 'PullRequest')
            {
              $MyNuGetVersion = $MyNuGetVersion -replace "preview", "alpha"
            }

            Write-Host "NuGet build number is $MyNuGetVersion"

            Write-Host "$("##vso[task.setvariable variable=MY_NUGET_VERSION]")$MyNuGetVersion"
    condition: succeeded()
    displayName: Get NuGet build number
    
  - task: NuGetCommand@2
    inputs:
      command: 'custom' 
      arguments: 'pack nuspec\Json.NetMF.nuspec -Version $(MY_NUGET_VERSION) -BasePath .\'
    displayName: Pack NuGet

  - task: CopyFiles@1
    inputs:
      sourceFolder: $(Build.SourcesDirectory)
      Contents: |
        **\Json*.nupkg
      TargetFolder: '$(Build.ArtifactStagingDirectory)'
      flattenFolders: true
    condition: succeeded()
    displayName: Collecting deployable artifacts

  # publish artifacts (only possible if this is not a PR originated on a fork)
  - task: PublishBuildArtifacts@1
    inputs:
      PathtoPublish: '$(Build.ArtifactStagingDirectory)'
      ArtifactName: deployables
      ArtifactType: Container
    condition: and( succeeded(), ne(variables['system.pullrequest.isfork'], true) )
    displayName: Publish deployables artifacts

  # push NuGet packages to MyGet feed (always happens except on PR builds)
  - task: NuGetCommand@2
    inputs:
      command: push
      nuGetFeedType: external
      packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
      publishFeedCredentials: 'MyGet'
    condition: succeeded()
    displayName: Push NuGet packages to MyGet

  # push NuGet class lib package to NuGet (happens on tag builds for any branch)
  - task: NuGetCommand@2
    inputs:
      command: push
      nuGetFeedType: external
      allowPackageConflicts: true
      packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
      publishFeedCredentials: 'NuGet'
    condition: and( succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v') )
    continueOnError: true
    displayName: Push NuGet packages to NuGet

  # create or update GitHub release
  - task: GitHubRelease@0
    inputs:
      gitHubConnection: nanoframework-token
      repositoryName: '$(Build.Repository.Name)'
      action: create
      target: '$(Build.SourceVersion)'
      tagSource: manual
      tag: 'v$(MY_NUGET_VERSION)-NETMF'
      title: 'Json.NetMF v$(MY_NUGET_VERSION)'
      releaseNotesSource: input
      releaseNotes: 'Check the [changelog]($(Build.Repository.Uri)/blob/$(Build.SourceBranchName)/CHANGELOG-NETMF.md).<br><br><h4>Install from nanoFramework MyGet development feed</h4><br>The following NuGet packages are available for download from this release:<br>:package: [.NET](https://www.myget.org/feed/nanoframework-dev/package/nuget/Json.NetMF/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION).'
      isDraft: true
      isPreRelease: true
      addChangeLog: false
    condition: and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ) )
    displayName: Create/Update GitHub release

  # create or update GitHub release ON tags from release or master branches
  - task: GitHubRelease@0
    inputs:
      gitHubConnection: nanoframework-token
      repositoryName: '$(Build.Repository.Name)'
      action: edit
      target: '$(Build.SourceVersion)'
      tagSource: manual
      tag: 'v$(MY_NUGET_VERSION)-NETMF'
      title: 'Json.NetMF v$(MY_NUGET_VERSION)'
      releaseNotesSource: input
      releaseNotes: 'Check the [changelog]($(Build.Repository.Uri)/blob/$(Build.SourceBranchName)/CHANGELOG-NETMF.md).<br><br><h4>Install from NuGet</h4><br>The following NuGet packages are available for download from this release:<br>:package: [.NET](https://www.nuget.org/packages/Json.NetMF/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION).'
      isDraft: false
      isPreRelease: true
      addChangeLog: false
    condition: and( succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), contains(variables['Build.SourceBranch'], 'preview') )
    displayName: Create/Update GitHub PREVIEW release

#######################################
# build
- job: Build_nF

  pool:
    vmImage: 'VS2017-Win2016'

  variables:
    solution: 'source/Json.nanoFramework.sln'
    buildPlatform: 'Any CPU'
    buildConfiguration: 'Release'

  steps:

  - checkout: self

  - script: |
      git config --global user.email "<EMAIL>"
      git config --global user.name "nfbot"
    displayName: Setup git identity

  - task: InstallnFBuildComponents@1
    displayName: Install nanoFramework MSBuild components

  - task: NuGetToolInstaller@0

  - task: NuGetCommand@2
    inputs:
      restoreSolution: '$(solution)'
      feedsToUse: config
      nugetConfigPath: source/NuGet.config
    displayName: NuGet restore

  - task: VSBuild@1
    inputs:
      solution: '$(solution)'
      platform: '$(buildPlatform)'
      msbuildArgs: '/p:PublicRelease=true'
      configuration: '$(buildConfiguration)'

  - task: PowerShell@2
    inputs:
        targetType: 'inline'
        script: |
            $MyNuGetVersion = $env:NBGV_NuGetPackageVersion -replace "\-g$env:NBGV_GitCommitIdShort", ""

            # replace preview with alpha if this is a PR build
            if($env:Build_Reason -eq 'PullRequest')
            {
              $MyNuGetVersion = $MyNuGetVersion -replace "preview", "alpha"
            }

            Write-Host "NuGet build number is $MyNuGetVersion"

            Write-Host "$("##vso[task.setvariable variable=MY_NUGET_VERSION]")$MyNuGetVersion"
    condition: succeeded()
    displayName: Get NuGet build number
    
  - task: NuGetCommand@2
    inputs:
      command: 'custom' 
      arguments: 'pack nuspec\Json.nanoFramework.nuspec -Version $(MY_NUGET_VERSION) -BasePath .\'
    displayName: Pack NuGet

  - task: CopyFiles@1
    inputs:
      sourceFolder: $(Build.SourcesDirectory)
      Contents: |
        **\nanoFramework.Json*.nupkg
      TargetFolder: '$(Build.ArtifactStagingDirectory)'
      flattenFolders: true
    condition: succeeded()
    displayName: Collecting deployable artifacts

  # publish artifacts (only possible if this is not a PR originated on a fork)
  - task: PublishBuildArtifacts@1
    inputs:
      PathtoPublish: '$(Build.ArtifactStagingDirectory)'
      ArtifactName: deployables
      ArtifactType: Container
    condition: and( succeeded(), ne(variables['system.pullrequest.isfork'], true) )
    displayName: Publish deployables artifacts

  # push NuGet packages to MyGet feed (always happens except on PR builds)
  - task: NuGetCommand@2
    inputs:
      command: push
      nuGetFeedType: external
      packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
      publishFeedCredentials: 'MyGet'
    condition: succeeded()
    displayName: Push NuGet packages to MyGet

  # push NuGet class lib package to NuGet (happens on tag builds for any branch)
  - task: NuGetCommand@2
    inputs:
      command: push
      nuGetFeedType: external
      allowPackageConflicts: true
      packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
      publishFeedCredentials: 'NuGet'
    condition: and( succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v') )
    continueOnError: true
    displayName: Push NuGet packages to NuGet

  # create or update GitHub release
  - task: GitHubRelease@0
    inputs:
      gitHubConnection: nanoframework-token
      repositoryName: '$(Build.Repository.Name)'
      action: create
      target: '$(Build.SourceVersion)'
      tagSource: manual
      tag: 'v$(MY_NUGET_VERSION)-NF'
      title: 'nanoframework.Json v$(MY_NUGET_VERSION)'
      releaseNotesSource: input
      releaseNotes: 'Check the [changelog]($(Build.Repository.Uri)/blob/$(Build.SourceBranchName)/CHANGELOG-NF.md).<br><br><h4>Install from nanoFramework MyGet development feed</h4><br>The following NuGet packages are available for download from this release:<br>:package: [.NET](https://www.myget.org/feed/nanoframework-dev/package/nuget/nanoFramework.Json/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION).'
      isDraft: true
      isPreRelease: true
      addChangeLog: false
    condition: and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ) )
    displayName: Create/Update GitHub release

  # create or update GitHub release ON tags from release or master branches
  - task: GitHubRelease@0
    inputs:
      gitHubConnection: nanoframework-token
      repositoryName: '$(Build.Repository.Name)'
      action: edit
      target: '$(Build.SourceVersion)'
      tagSource: manual
      tag: 'v$(MY_NUGET_VERSION)-NF'
      title: 'nanoframework.Json v$(MY_NUGET_VERSION)'
      releaseNotesSource: input
      releaseNotes: 'Check the [changelog]($(Build.Repository.Uri)/blob/$(Build.SourceBranchName)/CHANGELOG-NETMF.md).<br><br><h4>Install from NuGet</h4><br>The following NuGet packages are available for download from this release:<br>:package: [.NET](https://www.nuget.org/packages/nanoFramework.Json/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION).'
      isDraft: false
      isPreRelease: true
      addChangeLog: false
    condition: and( succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), contains(variables['Build.SourceBranch'], 'preview') )
    displayName: Create/Update GitHub PREVIEW release 

##################################
# report build failure to Discord
- job: Report_Build_Failure
  dependsOn:
  - Build_NETMF
  - Build_nF 
  condition: or( failed('Build_NETMF'), failed('Build_nF'))

  pool:
    vmImage: 'VS2017-Win2016'

  steps:
<commit_msg>Work CD-CI<commit_after>trigger:
  branches:
    include:
    - master
    - develop
    - release/*
    - refs/tags/*
  paths:
    exclude:
    - CHANGELOG.md
    - /*.md
    - .gitignore

pr:
  branches:
    include:
    - master
    - develop
    - release/*
  autoCancel: true

# add nf-tools repo to resources (for Azure Pipelines templates)
resources:
  repositories:
    - repository: templates
      type: github
      name: nanoframework/nf-tools
      endpoint: nanoframework

variables:
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

jobs:

###############################################
# build
- job: Build_NETMF

  pool:
    vmImage: 'vs2015-win2012r2'

  variables:
    solution: 'source/Json.NetMF.sln'
    buildPlatform: 'Any CPU'
    buildConfiguration: 'Release'

  steps:

  - checkout: self

  - script: |
      git config --global user.email "<EMAIL>"
      git config --global user.name "nfbot"
    displayName: Setup git identity

  - task: PowerShell@2
    inputs:
      targetType: 'inline'
      script: |
          Write-Output "Installing .NET MicroFramework 4.3 ..."

          $msiPath = "$($env:USERPROFILE)\MicroFrameworkSDK43.MSI"

          (New-Object Net.WebClient).DownloadFile('https://github.com/Azure/amqpnetlite/releases/download/netmf4.3/MicroFrameworkSDK4.3.MSI', $msiPath)

          & msiexec.exe /i $msiPath /quiet /log $env:USERPROFILE\netmf43.log | Write-Output

          Write-Output "NETMF43 Installed"

          Write-Output "Installing .NET MicroFramework 4.4 ..."

          $msiPath = "$($env:USERPROFILE)\MicroFrameworkSDK44.MSI"

          (New-Object Net.WebClient).DownloadFile('https://github.com/NETMF/netmf-interpreter/releases/download/v4.4-RTW-20-Oct-2015/MicroFrameworkSDK.MSI', $msiPath)

          & msiexec.exe /i $msiPath /quiet /log $env:USERPROFILE\netmf44.log | Write-Output

          Write-Output "NETMF44 Installed"

    displayName: Install .NETMF SDKs

  - task: NuGetToolInstaller@0

  - task: NuGetCommand@2
    inputs:
      restoreSolution: '$(solution)'
      feedsToUse: config
      nugetConfigPath: source/NuGet.config
    displayName: NuGet restore

  - task: VSBuild@1
    inputs:
      solution: '$(solution)'
      platform: '$(buildPlatform)'
      msbuildArgs: '/p:PublicRelease=true'
      configuration: '$(buildConfiguration)'

  - task: PowerShell@2
    inputs:
        targetType: 'inline'
        script: |
            $MyNuGetVersion = $env:NBGV_NuGetPackageVersion -replace "\-g$env:NBGV_GitCommitIdShort", ""

            # replace preview with alpha if this is a PR build
            if($env:Build_Reason -eq 'PullRequest')
            {
              $MyNuGetVersion = $MyNuGetVersion -replace "preview", "alpha"
            }

            Write-Host "NuGet build number is $MyNuGetVersion"

            Write-Host "$("##vso[task.setvariable variable=MY_NUGET_VERSION]")$MyNuGetVersion"
    condition: succeeded()
    displayName: Get NuGet build number
    
  - task: NuGetCommand@2
    inputs:
      command: 'custom' 
      arguments: 'pack nuspec\Json.NetMF.nuspec -Version $(MY_NUGET_VERSION) -BasePath .\'
    displayName: Pack NuGet

  - task: CopyFiles@1
    inputs:
      sourceFolder: $(Build.SourcesDirectory)
      Contents: |
        **\Json*.nupkg
      TargetFolder: '$(Build.ArtifactStagingDirectory)'
      flattenFolders: true
    condition: succeeded()
    displayName: Collecting deployable artifacts

  # publish artifacts (only possible if this is not a PR originated on a fork)
  - task: PublishBuildArtifacts@1
    inputs:
      PathtoPublish: '$(Build.ArtifactStagingDirectory)'
      ArtifactName: deployables
      ArtifactType: Container
    condition: and( succeeded(), ne(variables['system.pullrequest.isfork'], true) )
    displayName: Publish deployables artifacts

  # push NuGet packages to MyGet feed (always happens except on PR builds)
  - task: NuGetCommand@2
    inputs:
      command: push
      nuGetFeedType: external
      packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
      publishFeedCredentials: 'MyGet'
    condition: succeeded()
    displayName: Push NuGet packages to MyGet

  # push NuGet class lib package to NuGet (happens on tag builds for any branch)
  - task: NuGetCommand@2
    inputs:
      command: push
      nuGetFeedType: external
      allowPackageConflicts: true
      packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
      publishFeedCredentials: 'NuGet'
    condition: and( succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v') )
    continueOnError: true
    displayName: Push NuGet packages to NuGet

  # create or update GitHub release
  - task: GitHubReleasePublish@1
    inputs:
      githubEndpoint: 'nanoframework'
      githubOwner: 'nanoframework'
      githubRepositoryName: 'Json.NetMF'
      githubTag: 'v$(MY_NUGET_VERSION)-NETMF'
      githubReleaseTitle: 'Json.NetMF v$(MY_NUGET_VERSION)'
      githubReleaseNotes: 'Check the [changelog]($(Build.Repository.Uri)/blob/$(Build.SourceBranchName)/CHANGELOG-NETMF.md).<br><br><h4>Install from nanoFramework MyGet development feed</h4><br>The following NuGet packages are available for download from this release:<br>:package: [.NET](https://www.myget.org/feed/nanoframework-dev/package/nuget/Json.NetMF/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION).'
      githubTargetCommitsh: $(Build.SourceVersion)
      githubReleaseDraft: true
      githubReleasePrerelease: true
      githubReuseDraftOnly: true
      githubReuseRelease: true
      githubEditRelease: true
      githubReleaseAsset: '$(Build.ArtifactStagingDirectory)/*'
    condition: and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ) )
    displayName: Create/Update GitHub release

  # create or update GitHub release ON tags from release or master branches
  - task: GitHubReleasePublish@1
    inputs:
      githubEndpoint: 'nanoframework'
      githubOwner: 'nanoframework'
      githubRepositoryName: 'Json.NetMF'
      githubTag: 'v$(MY_NUGET_VERSION)-NETMF'
      githubReleaseTitle: 'Json.NetMF v$(MY_NUGET_VERSION)'
      githubReleaseNotes: 'Check the [changelog]($(Build.Repository.Uri)/blob/$(Build.SourceBranchName)/CHANGELOG-NETMF.md).<br><br><h4>Install from NuGet</h4><br>The following NuGet packages are available for download from this release:<br>:package: [.NET](https://www.nuget.org/packages/Json.NetMF/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION).'
      githubTargetCommitsh: $(Build.SourceVersion)
      githubReleaseDraft: false
      githubReleasePrerelease: false
      githubReuseDraftOnly: false
      githubReuseRelease: true
      githubEditRelease: true
      githubReleaseAsset: '$(Build.ArtifactStagingDirectory)/*.vsix'
    condition: and( succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), contains(variables['Build.SourceBranch'], 'vs2019'), or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) )
    displayName: Create/Update GitHub release on TAGs

#######################################
# build
- job: Build_nF

  pool:
    vmImage: 'VS2017-Win2016'

  variables:
    solution: 'source/Json.nanoFramework.sln'
    buildPlatform: 'Any CPU'
    buildConfiguration: 'Release'

  steps:

  - checkout: self

  - script: |
      git config --global user.email "<EMAIL>"
      git config --global user.name "nfbot"
    displayName: Setup git identity

  - task: InstallnFBuildComponents@1
    displayName: Install nanoFramework MSBuild components

  - task: NuGetToolInstaller@0

  - task: NuGetCommand@2
    inputs:
      restoreSolution: '$(solution)'
      feedsToUse: config
      nugetConfigPath: source/NuGet.config
    displayName: NuGet restore

  - task: VSBuild@1
    inputs:
      solution: '$(solution)'
      platform: '$(buildPlatform)'
      msbuildArgs: '/p:PublicRelease=true'
      configuration: '$(buildConfiguration)'

  - task: PowerShell@2
    inputs:
        targetType: 'inline'
        script: |
            $MyNuGetVersion = $env:NBGV_NuGetPackageVersion -replace "\-g$env:NBGV_GitCommitIdShort", ""

            # replace preview with alpha if this is a PR build
            if($env:Build_Reason -eq 'PullRequest')
            {
              $MyNuGetVersion = $MyNuGetVersion -replace "preview", "alpha"
            }

            Write-Host "NuGet build number is $MyNuGetVersion"

            Write-Host "$("##vso[task.setvariable variable=MY_NUGET_VERSION]")$MyNuGetVersion"
    condition: succeeded()
    displayName: Get NuGet build number
    
  - task: NuGetCommand@2
    inputs:
      command: 'custom' 
      arguments: 'pack nuspec\Json.nanoFramework.nuspec -Version $(MY_NUGET_VERSION) -BasePath .\'
    displayName: Pack NuGet

  - task: CopyFiles@1
    inputs:
      sourceFolder: $(Build.SourcesDirectory)
      Contents: |
        **\nanoFramework.Json*.nupkg
      TargetFolder: '$(Build.ArtifactStagingDirectory)'
      flattenFolders: true
    condition: succeeded()
    displayName: Collecting deployable artifacts

  # publish artifacts (only possible if this is not a PR originated on a fork)
  - task: PublishBuildArtifacts@1
    inputs:
      PathtoPublish: '$(Build.ArtifactStagingDirectory)'
      ArtifactName: deployables
      ArtifactType: Container
    condition: and( succeeded(), ne(variables['system.pullrequest.isfork'], true) )
    displayName: Publish deployables artifacts

  # push NuGet packages to MyGet feed (always happens except on PR builds)
  - task: NuGetCommand@2
    inputs:
      command: push
      nuGetFeedType: external
      packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
      publishFeedCredentials: 'MyGet'
    condition: succeeded()
    displayName: Push NuGet packages to MyGet

  # push NuGet class lib package to NuGet (happens on tag builds for any branch)
  - task: NuGetCommand@2
    inputs:
      command: push
      nuGetFeedType: external
      allowPackageConflicts: true
      packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
      publishFeedCredentials: 'NuGet'
    condition: and( succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v') )
    continueOnError: true
    displayName: Push NuGet packages to NuGet

  # create or update GitHub release
  - task: GitHubReleasePublish@1
    inputs:
      githubEndpoint: 'nanoframework'
      githubOwner: 'nanoframework'
      githubRepositoryName: 'Json.NetMF'
      githubTag: 'v$(MY_NUGET_VERSION)-NF'
      githubReleaseTitle: 'nanoframework.Json v$(MY_NUGET_VERSION)'
      githubReleaseNotes: 'Check the [changelog]($(Build.Repository.Uri)/blob/$(Build.SourceBranchName)/CHANGELOG-NF.md).<br><br><h4>Install from nanoFramework MyGet development feed</h4><br>The following NuGet packages are available for download from this release:<br>:package: [.NET](https://www.myget.org/feed/nanoframework-dev/package/nuget/nanoFramework.Json/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION).'
      githubTargetCommitsh: $(Build.SourceVersion)
      githubReleaseDraft: true
      githubReleasePrerelease: true
      githubReuseDraftOnly: true
      githubReuseRelease: true
      githubEditRelease: true
      githubReleaseAsset: '$(Build.ArtifactStagingDirectory)/*'
    condition: and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ) )
    displayName: Create/Update GitHub release

  # create or update GitHub release ON tags from release or master branches
  - task: GitHubReleasePublish@1
    inputs:
      githubEndpoint: 'nanoframework'
      githubOwner: 'nanoframework'
      githubRepositoryName: 'Json.NetMF'
      githubTag: 'v$(MY_NUGET_VERSION)-NF'
      githubReleaseTitle: 'nanoframework.Json v$(MY_NUGET_VERSION)'
      githubReleaseNotes: 'Check the [changelog]($(Build.Repository.Uri)/blob/$(Build.SourceBranchName)/CHANGELOG-NETMF.md).<br><br><h4>Install from NuGet</h4><br>The following NuGet packages are available for download from this release:<br>:package: [.NET](https://www.nuget.org/packages/nanoFramework.Json/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION).'
      githubTargetCommitsh: $(Build.SourceVersion)
      githubReleaseDraft: false
      githubReleasePrerelease: false
      githubReuseDraftOnly: false
      githubReuseRelease: true
      githubEditRelease: true
      githubReleaseAsset: '$(Build.ArtifactStagingDirectory)/*.vsix'
    condition: and( succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), contains(variables['Build.SourceBranch'], 'vs2019'), or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) )
    displayName: Create/Update GitHub release on TAGs

##################################
# report build failure to Discord
- job: Report_Build_Failure
  dependsOn:
  - Build_NETMF
  - Build_nF 
  condition: or( failed('Build_NETMF'), failed('Build_nF'))

  pool:
    vmImage: 'VS2017-Win2016'

  steps:

{'fraction_non_alphanumeric': 0.12015963331752806, 'fraction_numerical': 0.0070333491386122965, 'mean_word_length': 3.469975273754857, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 55, 'https://': 12, 'lorem ipsum': 0, 'www.': 8, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '765128', 'n_tokens_mistral': 7895, 'n_tokens_neox': 7497, 'n_words': 1735}