forked from WieldMore-io/WldMr.Excel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
108 lines (92 loc) · 3.09 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
trigger:
- '*'
pool:
name: Azure Pipelines
vmImage: 'windows-latest'
variables:
major: 0
minor: 9
revision: 0
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
patch: $[counter(format('{0}.{1}.{2}', variables['Major'], variables['Minor'], variables['Revision']), 0)]
packageVersion: $(major).$(minor).$(revision).$(patch)-preview
NUGET_PACKAGES: $(Pipeline.Workspace)/.nuget/packages
nugetApiKey: $(NUGET_API_KEY)
isNotaPR: $[ne(variables['Build.Reason'], 'PullRequest')]
${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
buildPrefix: 'PR - '
${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
${{ if eq(variables['Build.SourceBranchName'], 'master') }}:
buildPrefix: 'master - '
${{ if ne(variables['Build.SourceBranchName'], 'master') }}:
buildPrefix: $[ variables['Build.SourceBranchName'] ]
name: '$(buildPrefix)$(major).$(minor).$(revision).$(patch) - '
steps:
- task: DotNetCoreCLI@2
displayName: 'dotnet --info'
inputs:
command: custom
custom: '--info'
- task: DotNetCoreCLI@2
displayName: 'dotnet tool restore'
inputs:
command: custom
custom: tool
arguments: restore
- task: DotNetCoreCLI@2
displayName: 'dotnet paket restore'
inputs:
command: custom
custom: paket
arguments: 'restore'
- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
command: 'build'
arguments: >-
-p:Version=$(packageVersion) -p:InformationalVersion=$(packageVersion)-$(Build.SourceVersion)
--configuration $(buildConfiguration)
- task: DotNetCoreCLI@2
displayName: 'dotnet test'
inputs:
command: 'test'
projects: tests/**/*.fsproj
arguments: >-
--configuration $(buildConfiguration)
- task: DotNetCoreCLI@2
displayName: 'dotnet pack'
inputs:
command: 'custom'
custom: pack
arguments: >-
-p:Version=$(packageVersion) -p:InformationalVersion=$(packageVersion)-$(Build.SourceVersion)
--configuration $(buildConfiguration)
-o $(Build.ArtifactStagingDirectory)
- script: ls '$(Build.ArtifactStagingDirectory)'
- publish: $(Build.ArtifactStagingDirectory)
artifact: nupkgs
- script: ls '$(Build.ArtifactStagingDirectory)'
- task: GithubRelease@0
displayName: Create GitHub Release
condition: and(succeeded(), eq(variables.isNotaPR, true), eq(variables['Build.Repository.Uri'], 'https://github.com/WieldMore-io/WldMr.Excel'))
inputs:
gitHubConnection: github.com_PierreYvesR
repositoryName: WieldMore-io/WldMr.Excel
tagSource: manual
addChangeLog: false
isPreRelease: true
tag: $(packageVersion)
assets: $(Build.ArtifactStagingDirectory)/*.nupkg
- script: ls '$(Build.ArtifactStagingDirectory)'
- task: DotNetCoreCLI@2
displayName: Push to nuget.org
condition: and(succeeded(), eq(variables.isNotaPR, true), eq(variables['Build.Repository.Uri'], 'https://github.com/WieldMore-io/WldMr.Excel'))
inputs:
command: custom
custom: nuget
arguments: >
push "$(Build.ArtifactStagingDirectory)/**/*.nupkg"
-s https://api.nuget.org/v3/index.json
-k $(nugetApiKey)