pr:
  branches:
    include:
      - main
      - release/*
  paths:
    exclude:
      - core/**


pool:
  vmImage: 'ubuntu-22.04'

stages:
- stage: Build_Test_Pack
  jobs:
  - job: BuildTestPack
    displayName: 'Build, Test, and Pack'
    steps:

      - task: UseDotNet@2
        displayName: 'Use .NET 8'
        inputs:
          packageType: 'sdk'
          version: '8.0.x'

      - task: UseDotNet@2
        displayName: 'Use .NET 10'
        inputs:
          packageType: 'sdk'
          version: '10.0.x'

      - script: dotnet restore 
        displayName: 'Restore'

      - script: dotnet build --no-restore --configuration Release
        displayName: 'Build'

      - script: dotnet test --no-build --configuration Release
        displayName: 'Test'

      - script: dotnet pack --no-build -o $(Build.ArtifactStagingDirectory) /p:SymbolPackageFormat=snupkg --configuration Release
        displayName: 'Pack'

      - task: NuGetCommand@2
        displayName: 'Push NuGet Packages'
        condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
        inputs:
          command: push
          packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
          nuGetFeedType: internal
          publishVstsFeed: '$(System.TeamProject)/TeamsSDKPreviews'

      