-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
80 lines (69 loc) · 2.33 KB
/
azure-pipelines.yml
File metadata and controls
80 lines (69 loc) · 2.33 KB
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
pool:
vmImage: 'ubuntu-latest'
steps:
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: restore
projects: '$(Build.DefinitionName)/**/*.csproj'
- task: SonarCloudPrepare@1
inputs:
SonarCloud: 'Codoxide@SonarCloud'
organization: 'codoxide'
scannerMode: 'MSBuild'
projectKey: 'outcome'
projectName: 'Outcome'
- task: DotNetCoreCLI@2
displayName: Build
inputs:
projects: '$(Build.DefinitionName)/**/*.csproj'
arguments: '--configuration Release'
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: test
projects: '$(Build.DefinitionName)/*[Tt]ests/*.csproj'
arguments: '--configuration Release'
- task: SonarCloudAnalyze@1
enabled: false
- task: SonarCloudPublish@1
enabled: false
inputs:
pollingTimeoutSec: '300'
- task: PowerShell@2
displayName: 'Get Version'
inputs:
targetType: 'inline'
script: |
$proj = "$(Build.DefinitionName)"
$xml = [Xml] (Get-Content $proj/src/$proj.csproj)
$version = $xml.Project.PropertyGroup.Version
$qualifier = $proj.Substring($proj.LastIndexOf(".") + 1)
$tag = "$qualifier/$version"
Write-Host "Target Tag: $tag"
$tagCommit = (git rev-parse -q --verify "refs/tags/$tag")
$hasTag = $tagCommit.Length
Write-Host "Is Tagged: $hasTag"
Write-Host "##vso[task.setvariable variable=Version]$version"
Write-Host "##vso[task.setvariable variable=GitTag]$tag"
Write-Host "##vso[task.setvariable variable=IsTagged]$hasTag"
exit 0
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
- task: NuGetCommand@2
displayName: 'NuGet push'
inputs:
command: push
feedsToUse: config
externalFeedCredentials: 'NuGet.org PAT'
packagesToPush: '$(Build.SourcesDirectory)/$(Build.DefinitionName)/**/*.nupkg'
nuGetFeedType: external
publishFeedCredentials: 'NuGet.org PAT'
condition: and(succeeded(), eq(variables['IsTagged'], '0'))
- script: |
git config --global user.email "$(AuthorEmail)"
git config --global user.name "$(AuthorName)"
git tag -a $(GitTag) -m "$(TargetProject) Release v$(Version)"
git remote set-url origin https://$(GitHubTaggingPAT)@github.com/$(Build.Repository.Name)
git push origin $(GitTag)
displayName: "Tag Repo"
condition: and(succeeded(), eq(variables['IsTagged'], '0'))