Skip to content

Commit adca947

Browse files
committed
Update azure-pipelines.yml for Azure Pipelines
restore
1 parent 9b456d8 commit adca947

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

azure-pipelines.yml

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
trigger:
44
branches:
55
include:
6-
- dev/*
6+
- master
7+
- features/*
8+
- feature/*
9+
- releases/*
710
paths:
811
exclude:
912
- docs/*
@@ -14,7 +17,7 @@ variables:
1417
- group: GitRelease
1518

1619
- name: patch
17-
value: $[counter('versioncounter', 1)]
20+
value: $[counter('versioncounter', 100)]
1821
- name: buildPlatform
1922
value: 'Any CPU'
2023
- name: buildConfiguration
@@ -29,6 +32,12 @@ variables:
2932
value: '$(gitAccessToken)'
3033
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
3134
value: 1
35+
- name: BUILD_PUBLISH_ARTIFACTS
36+
value: $[or(startsWith(variables['Build.SourceBranch'], 'refs/heads/releases/'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))]
37+
- name: BUILD_IS_RELEASE
38+
value: $[startsWith(variables['Build.SourceBranch'], 'refs/heads/releases/')]
39+
- name: BUILD_IS_ALPHA
40+
value: $[eq(variables['Build.SourceBranch'], 'refs/heads/master')]
3241

3342
pool:
3443
vmImage: 'windows-2019'
@@ -79,7 +88,7 @@ jobs:
7988
searchFolder: '$(System.DefaultWorkingDirectory)'
8089

8190
- task: PowerShell@2
82-
condition: and(succeeded())
91+
condition: and(succeeded(), eq(variables['BUILD_PUBLISH_ARTIFACTS'], 'True'))
8392
displayName: dotnet publish
8493
inputs:
8594
targetType: 'inline'
@@ -94,8 +103,19 @@ jobs:
94103
& 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
95104
96105
- task: PowerShell@2
97-
condition: and(succeeded())
98-
displayName: dotnet pack dev
106+
condition: and(succeeded(), eq(variables['BUILD_IS_RELEASE'], 'True'))
107+
displayName: dotnet pack release
108+
inputs:
109+
targetType: 'inline'
110+
script: |
111+
mkdir $(Build.ArtifactStagingDirectory)\nupkg
112+
Write-Host $(PackageVersion)
113+
Write-Host $(PackageVersionCLI)
114+
& dotnet pack $(Build.SourcesDirectory)\src\Generator.Client.CommandLine\Generator.Client.CommandLine.csproj -c $(buildConfiguration) -o $(Build.ArtifactStagingDirectory)\nupkg /p:PackAsTool=true /p:VersionPrefix=$(PackageVersionCLI) /p:SymbolPackageFormat=snupkg --include-symbols --version-suffix=beta
115+
116+
- task: PowerShell@2
117+
condition: and(succeeded(), eq(variables['BUILD_IS_ALPHA'], 'True'))
118+
displayName: dotnet pack alpha
99119
inputs:
100120
targetType: 'inline'
101121
script: |
@@ -106,31 +126,32 @@ jobs:
106126
$commandSample = "dotnet pack $(Build.SourcesDirectory)\src\Generator.Client.CommandLine\Generator.Client.CommandLine.csproj -c $(buildConfiguration) -o $(Build.ArtifactStagingDirectory)\nupkg /p:PackAsTool=true /p:VersionPrefix=$(PackageVersionCLI) /p:SymbolPackageFormat=snupkg --include-symbols --version-suffix=alpha"
107127
Write-Host $commandSample
108128
Invoke-Expression $commandSample
129+
& dotnet pack $(Build.SourcesDirectory)\src\Generator.Client.CommandLine\Generator.Client.CommandLine.csproj -c $(buildConfiguration) -o $(Build.ArtifactStagingDirectory)\nupkg /p:PackAsTool=true /p:VersionPrefix=$(PackageVersionCLI) /p:SymbolPackageFormat=snupkg --include-symbols --version-suffix=alpha
109130
110131
- task: CopyFiles@2
111-
condition: and(succeeded())
132+
condition: and(succeeded(), eq(variables['BUILD_PUBLISH_ARTIFACTS'],'True'))
112133
inputs:
113134
SourceFolder: '$(Build.SourcesDirectory)'
114135
Contents: |
115136
**/*.md
116137
TargetFolder: '$(Build.ArtifactStagingDirectory)'
117138

118139
- task: PowerShell@2
119-
condition: and(succeeded())
140+
condition: and(succeeded(), eq(variables['BUILD_PUBLISH_ARTIFACTS'],'True'))
120141
displayName: zip artifacts
121142
inputs:
122143
targetType: 'inline'
123144
script: |
124145
7z a $(Build.ArtifactStagingDirectory)\TemplateGenerator_$(PackageVersion)_win64.zip $(Build.ArtifactStagingDirectory)\*
125146
126147
- task: PublishPipelineArtifact@0
127-
condition: and(succeeded())
148+
condition: and(succeeded(), eq(variables['BUILD_PUBLISH_ARTIFACTS'],'True'))
128149
inputs:
129150
artifactName: 'drop'
130151
targetPath: '$(Build.ArtifactStagingDirectory)\TemplateGenerator_$(PackageVersion)_win64.zip'
131152

132153
- task: PublishPipelineArtifact@0
133-
condition: and(succeeded())
154+
condition: and(succeeded(), eq(variables['BUILD_PUBLISH_ARTIFACTS'],'True'))
134155
inputs:
135156
artifactName: 'nupkg'
136157
targetPath: '$(Build.ArtifactStagingDirectory)\nupkg'

0 commit comments

Comments
 (0)