|
| 1 | +trigger: |
| 2 | + branches: |
| 3 | + include: |
| 4 | + - master |
| 5 | + - develop |
| 6 | + paths: |
| 7 | + exclude: |
| 8 | + - .editorconfig |
| 9 | + - README.md |
| 10 | + - stylecop.json |
| 11 | + |
| 12 | +# Must be Windows due to the .NET 4.5 build target |
| 13 | +pool: |
| 14 | + vmImage: 'windows-latest' |
| 15 | + |
| 16 | +variables: |
| 17 | + buildConfiguration: 'Release' |
| 18 | + buildPlatform: 'Any CPU' |
| 19 | + buildVersion: '0.0.0' |
| 20 | + projectPath: '.\MicroLite.Extensions.WebApi.OData\MicroLite.Extensions.WebApi.OData.csproj' |
| 21 | + solution: '**/*.sln' |
| 22 | + |
| 23 | +steps: |
| 24 | +- task: NuGetToolInstaller@1 |
| 25 | + |
| 26 | +- task: NuGetCommand@2 |
| 27 | + inputs: |
| 28 | + restoreSolution: '$(solution)' |
| 29 | + |
| 30 | +- task: VSBuild@1 |
| 31 | + inputs: |
| 32 | + solution: '$(solution)' |
| 33 | + platform: '$(buildPlatform)' |
| 34 | + configuration: '$(buildConfiguration)' |
| 35 | + |
| 36 | +- task: VSTest@2 |
| 37 | + inputs: |
| 38 | + platform: '$(buildPlatform)' |
| 39 | + configuration: '$(buildConfiguration)' |
| 40 | + codeCoverageEnabled: true |
| 41 | + |
| 42 | +- task: PowerShell@2 |
| 43 | + inputs: |
| 44 | + targetType: 'inline' |
| 45 | + script: | |
| 46 | + $projVersion = ([xml](Get-Content "$(projectPath)")) | Select-Xml -XPath "//Project/PropertyGroup[1]/Version" |
| 47 | +
|
| 48 | + Write-Host "##vso[task.setvariable variable=buildVersion]$projVersion" |
| 49 | +
|
| 50 | +- script: dotnet pack "$(projectPath)" -o:$(Build.ArtifactStagingDirectory) -p:PackageVersion="$(buildVersion)-preview$(Build.BuildNumber)" |
| 51 | + displayName: 'dotnet pack (pre)' |
| 52 | + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop')) |
| 53 | + |
| 54 | +- script: dotnet pack "$(projectPath)" -o:$(Build.ArtifactStagingDirectory) -p:PackageVersion=$(buildVersion) |
| 55 | + displayName: 'dotnet pack' |
| 56 | + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) |
| 57 | + |
| 58 | +- task: NuGetCommand@2 |
| 59 | + inputs: |
| 60 | + command: 'push' |
| 61 | + packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg' |
| 62 | + nuGetFeedType: 'external' |
| 63 | + publishFeedCredentials: 'NuGet.org (MicroLite-ORM)' |
| 64 | + condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual')) |
0 commit comments