-
Notifications
You must be signed in to change notification settings - Fork 4
/
azure-pipelines.yml
96 lines (83 loc) · 3.3 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
trigger:
- main
- 'v*.*'
pr:
- main
parameters:
- name: DoRelease
displayName: Release
type: boolean
default: false
pool:
vmImage: windows-2022
variables:
BuildConfiguration: Release
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
stages:
- stage: Build
jobs:
- job: BuildSLN
steps:
- task: UseDotNet@2
inputs:
packageType: "sdk"
version: "7.0.102"
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: tool
arguments: install --tool-path . nbgv
displayName: Install NBGV tool
- script: nbgv cloud
displayName: Set Version
- task: DotNetCoreCLI@2
inputs:
command: build
projects: .\AntiXSS.sln
arguments: -c $(BuildConfiguration)
displayName: Build
- powershell: |
mkdir $(Build.ArtifactStagingDirectory)\Packages
$version = .\nbgv get-version -f json | ConvertFrom-Json
dotnet pack .\Microsoft.Security.Application.Encoder\Microsoft.Security.Application.Encoder.csproj -c $(BuildConfiguration) --no-build -o $(Build.ArtifactStagingDirectory)\Packages /p:NuspecProperties="version=$($version.NuGetPackageVersion);RepositoryType=git;RepositoryCommit=$($version.GitCommitId);RepositoryUrl=https://github.com/hangy/AntiXSS"
dotnet pack .\Microsoft.Security.Application.HtmlSanitization\Microsoft.Security.Application.HtmlSanitization.csproj -c $(BuildConfiguration) --no-build -o $(Build.ArtifactStagingDirectory)\Packages /p:NuspecProperties="version=$($version.NuGetPackageVersion);RepositoryType=git;RepositoryCommit=$($version.GitCommitId);RepositoryUrl=https://github.com/hangy/AntiXSS"
displayName: Create packages
- task: DotNetCoreCLI@2
inputs:
command: test
projects: |
.\Microsoft.Security.Application.Encoder.UnitTests\Microsoft.Security.Application.Encoder.UnitTests.csproj
.\Microsoft.Security.Application.HtmlSanitization\Microsoft.Security.Application.HtmlSanitization.csproj
arguments: -c $(BuildConfiguration) --no-build
displayName: Run Tests
- publish: $(Build.ArtifactStagingDirectory)\Packages
artifact: Packages
- stage: Release
dependsOn: Build
condition: and(succeeded(), ${{ parameters.DoRelease }})
jobs:
- job: NuGet
steps:
- checkout: none
- download: current
artifact: Packages
- task: DotNetCoreCLI@2
displayName: "dotnet push"
inputs:
command: push
packagesToPush: "$(Pipeline.Workspace)/Packages/*.nupkg"
nuGetFeedType: external
publishFeedCredentials: NuGet
- job: GitHub
steps:
- checkout: none
- download: current
artifact: Packages
- task: GitHubRelease@1
displayName: "Create GitHub Release"
inputs:
gitHubConnection: hangy
repositoryName: "$(Build.Repository.Name)"
action: Create
target: "$(Build.SourceVersion)"
assets: "$(Pipeline.Workspace)/Packages/*"