forked from secana/PeNet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
110 lines (94 loc) · 3.18 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
102
103
104
105
106
107
108
109
110
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
branches:
include:
- '*'
tags:
include:
- '*'
jobs:
- job: LinuxTest
displayName: Linux Tests
pool:
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
steps:
- task: UseDotNet@2
displayName: "Use .NET 7.x"
inputs:
version: '7.x'
packageType: sdk
- task: DotNetCoreCLI@2
displayName: 'Run Unit-Tests'
inputs:
command: test
projects: '**/*Test/*.csproj'
arguments: '--configuration $(buildConfiguration)'
- job: WindowsBuildAndDeploy
displayName: Windows CI/CD
dependsOn: 'LinuxTest'
pool:
vmImage: 'windows-latest'
variables:
buildConfiguration: 'Release'
steps:
- powershell: $version = ($env:Build_SourceBranch -replace 'refs/tags/v',''); echo $version; echo "##vso[task.setvariable variable=version]$version"
displayName: Get version from tag
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
- powershell: ((Get-Content -path .\src\PeNet\PeNet.csproj -Raw) -replace '0.0.0',$env:version) | Set-Content -Path .\src\PeNet\PeNet.csproj
displayName: Replace version with git tag
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
- task: UseDotNet@2
displayName: "Use .NET 7.x"
inputs:
version: '7.x'
packageType: sdk
- task: DotNetCoreCLI@2
displayName: 'Run Unit-Tests'
inputs:
command: test
projects: '**/*test/*.csproj'
arguments: '--configuration $(buildConfiguration) --collect "Code coverage"'
- script: choco install docfx
displayName: Install DocFX
- script: docfx metadata
displayName: Build Documentation Meta-Data
workingDirectory: '$(Build.SourcesDirectory)/docfx'
- script: docfx build
displayName: Build Documentation
workingDirectory: '$(Build.SourcesDirectory)/docfx'
- task: GitHubPagesPublish@1
displayName: Publish Documentation
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
docPath: '$(System.DefaultWorkingDirectory)\docs\*'
githubusername: "secana"
githubemail: '[email protected]'
githubaccesstoken: $(token.github.penet.gh-pages)
repositoryname: 'PeNet'
branchname: 'gh-pages'
commitmessage: 'Automated gh-pages update'
cleanRepository: false
- task: NuGetToolInstaller@0
displayName: Install NuGet
inputs:
versionSpec: '5.4.0'
- task: DotNetCoreCLI@2
displayName: 'Pack Nuget Package'
inputs:
command: 'pack'
packagesToPack: '**\src\**\*.csproj'
configuration: $(buildConfiguration)
- task: NuGetCommand@2
displayName: 'Publish NuGet Packages'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
inputs:
command: push
nuGetFeedType: external
allowPackageConflicts: true
publishFeedCredentials: 'Nuget.org'
packagesToPush: '$(build.artifactStagingDirectory)/*.nupkg'