-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathazure-pipelines.yml
66 lines (56 loc) · 1.7 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
trigger: none
pool:
vmImage: 'windows-latest'
variables:
solution: 'src/CI.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
vstsFeed: 'ef0ec01d-ca78-4a45-b436-d15c2cb7d442/357f07e2-1d5e-49e3-b6e9-afeca369ffdb'
name: '$(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)'
steps:
- task: Powershell@2
displayName: 'Apply Build Version'
inputs:
targetType: 'inline'
script: |
$version = '7.0.' + "$env:Build_BuildNumber"
$pattern = '\[assembly: AssemblyVersion\("(.*)"\)\]'
$AssemblyFiles = Get-ChildItem . AssemblyInfo.cs -rec
foreach ($file in $AssemblyFiles)
{
(Get-Content $file.PSPath) | ForEach-Object
{
if($_ -match $pattern)
{
'[assembly: AssemblyVersion("{0}")]' -f $version
} else
{
$_
}
} | Set-Content $file.PSPath
}
- task: UseDotNet@2
displayName: 'Install .NET Core sdk'
inputs:
packageType: 'sdk'
version: '7.0.x'
- task: DotNetCoreCLI@2
displayName: 'Restore packages'
inputs:
command: 'restore'
projects: '**/*.csproj'
feedsToUse: 'select'
vstsFeed: '$(vstsFeed)'
- task: DotNetCoreCLI@2
displayName: 'Build and pack'
inputs:
command: 'pack'
arguments: '--configuration $(buildConfiguration) $(solution)'
versioningScheme: byBuildNumber
- task: DotNetCoreCLI@2
displayName: 'Push to Azure DevOps Artifacts'
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: '$(vstsFeed)'