-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathazure-pipelines.yml
101 lines (89 loc) · 2.87 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
trigger:
branches:
include:
- dev
- master
paths:
exclude:
- '*/README.md'
- '*/.github/*'
- '*/LICENSE.md'
- '*/CHANGELOG.md'
pr: none
pool:
vmImage: 'windows-latest'
variables:
- group: 'Package Versioning'
- name: buildPlatform
value: 'Any CPU'
- name: buildConfiguration
value: 'Release'
- name: buildDirPath
value: '$(Build.SourcesDirectory)\src\ReCaptcha\bin\$(buildPlatform)\$(buildConfiguration)'
jobs:
- job: Init
displayName: Initialize & Versioning
steps:
- powershell: |
if('$(Build.SourceBranch)' -eq 'refs/heads/master')
{
Write-Host "##vso[task.setvariable variable=version;isOutput=true]$(major).$(minor).$(patch)"
}
else
{
Write-Host "##vso[task.setvariable variable=version;isOutput=true]$(major).$(minor).$(patch)-ci$(Build.BuildId)"
}
displayName: Set Package Version
name: package
- job: BuildPack
displayName: Build & Pack
dependsOn: Init
variables:
- name: packageVersion
value: $[ dependencies.Init.outputs['package.version'] ]
steps:
- task: MSBuild@1
displayName: Build & Pack Project
inputs:
solution: '**/src/ReCaptcha/ReCaptcha.csproj'
configuration: $(buildConfiguration)
platform: $(buildPlatform)
msbuildArguments: '/restore /t:Build /t:Pack /p:ContinuousIntegrationBuild=true /p:Deterministic=false /p:PackageVersion=$(packageVersion) /p:PackageOutputPath="$(buildDirPath)"'
- task: PublishBuildArtifacts@1
displayName: Publish Build Artifacts
inputs:
PathtoPublish: '$(buildDirPath)'
ArtifactName: 'nuget'
publishLocation: 'Container'
- job: Test
displayName: Run Unit Tests
dependsOn: Init
steps:
- task: DotNetCoreCLI@2
displayName: Run Tests
inputs:
command: 'test'
publishTestResults: true
projects: '**/tests/ReCaptcha.Tests/ReCaptcha.Tests.csproj'
testRunTitle: 'Project Unit Tests'
workingDirectory: '$(System.DefaultWorkingDirectory)'
- deployment: PushToTestFeed
displayName: Push to Development Feed
dependsOn:
- BuildPack
- Test
condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/master'))
environment: Development
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: nuget
- task: NuGetCommand@2
inputs:
command: 'push'
packagesToPush: '$(Pipeline.Workspace)/**/*.nupkg;!$(Pipeline.Workspace)/**/*.snupkg'
nuGetFeedType: 'internal'
publishVstsFeed: 'f9036ec9-eb1c-4aff-a2b8-27fdaa573d0f/29b705d0-eac8-42a7-9230-4bcfe9f83688'
allowPackageConflicts: true