-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathazure-pipelines.yml
140 lines (123 loc) · 4.9 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
# https://aka.ms/yaml
trigger:
branches:
include:
- master
- features/*
- feature/*
- releases/*
- dev/*
paths:
include:
- src/*
variables:
- group: GitRelease
- name: patch
value: $[counter('versioncounter', 100)]
- name: buildPlatform
value: 'Any CPU'
- name: buildConfiguration
value: 'Release'
- name: GitHubApplicationName
value: 'Amusoft.VisualStudio.TemplateGenerator'
- name: GitHubRepoName
value: 'Amusoft.VisualStudio.TemplateGenerator'
- name: GitHubAssetsPattern
value: '$(Build.ArtifactStagingDirectory)\*.zip'
- name: GitHubAccessToken
value: '$(gitAccessToken)'
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
value: 1
- name: BUILD_PUBLISH_ARTIFACTS
value: $[or(startsWith(variables['Build.SourceBranch'], 'refs/heads/releases/'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))]
- name: BUILD_IS_RELEASE
value: $[startsWith(variables['Build.SourceBranch'], 'refs/heads/releases/')]
- name: BUILD_IS_ALPHA
value: $[eq(variables['Build.SourceBranch'], 'refs/heads/master')]
pool:
vmImage: 'windows-2019'
jobs:
- job:
displayName: Build
condition: succeeded()
steps:
- task: DotNetCoreCLI@2
displayName: dotnet restore
inputs:
command: 'restore'
projects: '**/*.csproj'
feedsToUse: 'select'
verbosityRestore: 'Minimal'
- task: DotNetCoreCLI@2
displayName: dotnet build
inputs:
command: 'build'
projects: '**/*.csproj'
feedsToUse: 'select'
- task: DotNetCoreCLI@2
displayName: dotnet test
inputs:
command: 'test'
projects: '**/*.csproj'
feedsToUse: 'select'
- task: DotNetCoreCLI@2
displayName: dotnet pack release
condition: and(succeeded(), eq(variables['BUILD_IS_RELEASE'], 'True'))
inputs:
command: 'pack'
packagesToPack: '**/*CommandLine.csproj'
configuration: '$(buildConfiguration)'
packDirectory: '$(Build.ArtifactStagingDirectory)\nupkg'
includesymbols: true
versioningScheme: 'off'
buildProperties: 'PackAsTool=True;SymbolPackageFormat=snupkg'
verbosityPack: 'Minimal'
- task: DotNetCoreCLI@2
displayName: dotnet pack alpha
condition: and(succeeded(), eq(variables['BUILD_IS_ALPHA'], 'True'))
inputs:
command: 'pack'
packagesToPack: '**/*CommandLine.csproj'
configuration: '$(buildConfiguration)'
packDirectory: '$(Build.ArtifactStagingDirectory)\nupkg'
includesymbols: true
versioningScheme: 'off'
buildProperties: 'PackAsTool=True;SymbolPackageFormat=snupkg;VersionSuffix=alpha$(Build.BuildId)'
verbosityPack: 'Minimal'
- task: PowerShell@2
condition: and(succeeded(), eq(variables['BUILD_PUBLISH_ARTIFACTS'], 'True'))
displayName: dotnet publish
inputs:
targetType: 'inline'
script: |
mkdir $(Build.ArtifactStagingDirectory)\desktop
& dotnet build $(Build.SourcesDirectory)\src\Generator.Client.Desktop\Generator.Client.Desktop.csproj -r win-x64 -c $(buildConfiguration)
& dotnet publish $(Build.SourcesDirectory)\src\Generator.Client.Desktop\Generator.Client.Desktop.csproj -r win-x64 -c $(buildConfiguration) --self-contained --no-build -o $(Build.ArtifactStagingDirectory)\desktop
mkdir $(Build.ArtifactStagingDirectory)\cli-netcore2.1-standalone
mkdir $(Build.ArtifactStagingDirectory)\cli-netcore2.1-shared
& dotnet publish $(Build.SourcesDirectory)\src\Generator.Client.CommandLine\Generator.Client.CommandLine.csproj -r win-x64 -f netcoreapp2.1 -c $(buildConfiguration) --self-contained true -o $(Build.ArtifactStagingDirectory)\cli-netcore2.1-standalone
& dotnet publish $(Build.SourcesDirectory)\src\Generator.Client.CommandLine\Generator.Client.CommandLine.csproj -r win-x64 -f netcoreapp2.1 -c $(buildConfiguration) --self-contained false -o $(Build.ArtifactStagingDirectory)\cli-netcore2.1-shared
- task: CopyFiles@2
condition: and(succeeded(), eq(variables['BUILD_PUBLISH_ARTIFACTS'],'True'))
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Contents: |
**/*.md
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PowerShell@2
condition: and(succeeded(), eq(variables['BUILD_PUBLISH_ARTIFACTS'],'True'))
displayName: zip artifacts
inputs:
targetType: 'inline'
script: |
7z a $(Build.ArtifactStagingDirectory)\TemplateGenerator_$(Build.BuildId)_win64.zip $(Build.ArtifactStagingDirectory)\*
- task: PublishPipelineArtifact@0
condition: and(succeeded(), eq(variables['BUILD_PUBLISH_ARTIFACTS'],'True'))
inputs:
artifactName: 'drop'
targetPath: '$(Build.ArtifactStagingDirectory)\TemplateGenerator_$(Build.BuildId)_win64.zip'
- task: PublishPipelineArtifact@0
condition: and(succeeded(), eq(variables['BUILD_PUBLISH_ARTIFACTS'],'True'))
inputs:
artifactName: 'nupkg'
targetPath: '$(Build.ArtifactStagingDirectory)\nupkg'