-
Notifications
You must be signed in to change notification settings - Fork 5
/
azure-pipelines.yml
98 lines (90 loc) · 2.92 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
# ASP.NET
# Build and test ASP.NET projects.
# Add steps that publish symbols, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4
trigger:
branches:
include:
- master
# no PR triggers
pr: none
pool: 'Umbraco-UK-Staging'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
stages:
- stage: build
displayName: Build
jobs:
- job: Build
pool: 'Umbraco-UK-Staging'
steps:
- checkout: self
persistCredentials: true
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
command: 'restore'
restoreSolution: '**/*.sln'
feedsToUse: 'config'
nugetConfigPath: '$(System.DefaultWorkingDirectory)\NuGet.config'
- task: VSBuild@1
inputs:
solution: '$(solution)'
configuration: '$(buildConfiguration)'
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
$version = Get-ChildItem ".\sem.ver" | Get-Content
$nuspecs = Get-ChildItem -Path ..\*\*.nuspec -Recurse -Force;
$nuspecs | Foreach-Object {
[xml]$xml = Get-Content -path $_.FullName -Raw
$ns = [System.Xml.XmlNamespaceManager]::new($xml.NameTable)
$ns.AddNamespace('nuspec', 'http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd')
write-host [xml]$xml
$xml.package.metadata.version= $version.ToString();
[xml]$xml.Save($_.FullName)
}
cd $(Build.SourcesDirectory)
git config --global user.email "[email protected]"
git config --global user.name "DEVOPS"
git tag -a $version -m 'tag message'
git push --tags -q
Write-Host "##vso[build.updatebuildnumber]$version"
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: NuGetCommand@2
inputs:
command: 'pack'
packagesToPack: '**/*.nuspec'
versioningScheme: 'off'
includeSymbols: false
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'publish artifacts'
publishLocation: 'Container'
- stage: deploy
displayName: Stable Deployment
pool: 'Umbraco-UK-Staging'
dependsOn: build
jobs:
- job: Deploy
pool: 'Umbraco-UK-Staging'
steps:
- task: DeleteFiles@1
inputs:
SourceFolder: '$(Pipeline.Workspace)/publish artifacts/'
Contents: '**/*'
RemoveSourceFolder: true
- download: current
artifact: 'publish artifacts'
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
displayName: Push to DK feed
inputs:
command: 'push'
packagesToPush: '$(Pipeline.Workspace)/publish artifacts/**/*.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'Nuget'