-
-
Notifications
You must be signed in to change notification settings - Fork 201
/
azure-pipelines.yml
173 lines (154 loc) · 5.25 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
resources:
- repo: self
variables:
- name: BuildConfiguration
value: 'Release'
- name: System.Debug
value: true
- name: DOTNET_CLI_TELEMETRY_OPTOUT
value: true
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
value: true
- group: GitHub_Feed
- group: Zendesk_Creds
trigger:
batch: true
branches:
include:
- master
- refs/tags/*
pr:
branches:
include:
- master
paths:
exclude:
- docs/*
pool:
vmImage: 'windows-latest'
jobs:
- job: Build
displayName: Build and Test
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
version: 3.0.103
installationPath: $(Agent.ToolsDirectory)/dotnet
- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
command: build
projects: 'src/ZendeskApi_v2.sln'
arguments: '-c $(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: 'dotnet test'
inputs:
command: test
projects: 'tests/ZendeskApi_v2.Tests/ZendeskApi_v2.Tests.csproj'
arguments: '--no-build -c $(BuildConfiguration) -- NUnit.StopOnError=true'
env:
admin__id: $(Admin.ID)
admin__email: $(Admin.Email)
admin__password: $(Admin.Password)
admin__apiToken: $(Admin.ApiToken)
- task: DotNetCoreCLI@2
displayName: 'dotnet pack'
inputs:
command: pack
searchPatternPack: 'src/ZendeskApi_v2/ZendeskApi_v2.csproj'
nobuild: true
- task: PowerShell@2
inputs:
filePath: .\ci\sign-package.ps1
env:
SignClientUser: $(speedygeek.signClientUser)
SignClientSecret: $(speedygeek.signClientSecret)
displayName: 'Authenticode sign packages'
condition: and(succeeded(), ne(variables['speedygeek.signClientUser'], ''), ne(variables['speedygeek.signClientSecret'], ''))
- task: PublishPipelineArtifact@1
displayName: 'Publish Artifact: Nuget_Package'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'Nuget_Package'
- job: Publish
displayName: Publish Nuget packages
dependsOn: Build
condition: and(succeeded(),or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'], 'refs/tags/v3.')))
steps:
- checkout: none
- task: DownloadPipelineArtifact@2
inputs:
path: $(Pipeline.Workspace)/Nuget_Package
artifact: 'Nuget_Package'
- task: PowerShell@2
displayName: 'Is Pre-release'
inputs:
targetType: inline
pwsh: true
script: |
$buildNumber = $env:Build_BuildNumber
$IsPrerelease = $false;
if( $buildNumber.Contains("-") -or $buildNumber.Contains("+")){
$IsPrerelease = $true;
}
Write-Host "IsPrerelease: $IsPrerelease "
Write-Host "##vso[task.setvariable variable=IsPrerelease]$IsPrerelease"
$date=$(Get-Date -Format "dd MMMM yyyy");
Write-Host "##vso[task.setvariable variable=ReleaseDate]$date"
#- task: NuGetCommand@2
# displayName: 'GitHub Feed (Pre-release)'
# condition: and(succeeded(),eq(variables['IsPrerelease'] ,'True'))
# inputs:
# command: push
# packagesToPush: '$(Pipeline.Workspace)/**/*.nupkg;!$(Pipeline.Workspace)/**/*.symbols.nupkg'
# nuGetFeedType: external
# publishFeedCredentials: 'Github Nuget Feed'
- task: PowerShell@2
displayName: 'GitHub Feed (Pre-release)'
condition: and(succeeded(),eq(variables['IsPrerelease'] ,'True'))
env:
apikey: $(github_feed_apikey)
inputs:
targetType: inline
script: |
Write-Host -ForegroundColor Cyan "starting github push"
$api = "$Env:apikey"
$url = "$Env:github_feed_url"
Write-Host -ForegroundColor Cyan "Feed url $url"
Write-Host -ForegroundColor Cyan "api key length is " $api.Length
dotnet nuget push "$(Pipeline.Workspace)/**/*.nupkg" --no-symbols true --skip-duplicate -k "$api" -s "$url"
showWarnings: true
pwsh: true
- task: NuGetCommand@2
displayName: 'MyGet Feed (Pre-release)'
condition: and(succeeded(), eq(variables['IsPrerelease'] ,'True'))
inputs:
command: push
packagesToPush: '$(Pipeline.Workspace)/**/*.nupkg;!$(Pipeline.Workspace)/**/*.symbols.nupkg'
nuGetFeedType: external
publishFeedCredentials: MyGet
- task: NuGetCommand@2
displayName: 'NuGet push'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v3.'),eq(variables['IsPrerelease'] ,'False'))
inputs:
command: push
packagesToPush: '$(Pipeline.Workspace)/**/*.nupkg;!$(Pipeline.Workspace)/**/*.symbols.nupkg'
nuGetFeedType: external
publishFeedCredentials: Nuget.org
- task: GitHubRelease@1
displayName: 'Create GitHub Release'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v3.'),eq(variables['IsPrerelease'] ,'False'))
inputs:
gitHubConnection: Github
repositoryName: 'Speedygeek/ZendeskApi_v2'
tagSource: gitTag
title: '$(Build.BuildNumber) ($(ReleaseDate))'
releaseNotesSource: inline
assets: '$(Pipeline.Workspace)/**/*.nupkg'
isDraft: true