-
Notifications
You must be signed in to change notification settings - Fork 2
/
package.yml
53 lines (41 loc) · 1.98 KB
/
package.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
parameters:
# Default values
useVersionSuffix: true
versionSuffix: ''
artifactName: 'NuGetPackages'
steps:
- powershell: |
[string] $versionSuffix = '${{ parameters.versionSuffix }}'
[string] $addBuildNumber = '${{ parameters.useVersionSuffix }}'
Write-Host "Add Build Number: $addBuildNumber"
if ([string]::IsNullOrEmpty($versionSuffix) -and $addBuildNumber -eq 'true')
{
$versionSuffix = $env:BUILD_BUILDNUMBER
}
Write-Host "Version Suffix: $versionSuffix"
Write-Host "##vso[task.setvariable variable=VersionSuffixPackage;]$versionSuffix"
displayName: 'Retrieve version suffix for packaging'
- powershell: |
Write-Host "Determining if version suffix should be used"
[string]$useVersionSuffix = 'true'
[string]$versionSuffix = '$(VersionSuffixPackage)'
Write-Host "Version Suffix: $versionSuffix"
if ([string]::IsNullOrEmpty($versionSuffix))
{
$useVersionSuffix = 'false'
}
Write-Host "Use Version Suffix: $useVersionSuffix"
Write-Host "##vso[task.setvariable variable=UseVersionSuffix;]$useVersionSuffix"
displayName: 'Determine version suffix use for packaging'
# Package nugets
- script: dotnet pack --no-build --configuration $(buildConfiguration) --version-suffix $(VersionSuffixPackage) --output $(Build.artifactStagingDirectory)/packages
displayName: 'dotnet pack $(buildConfiguration) with version suffix'
condition: and(succeeded(), eq(variables.UseVersionSuffix, 'true'))
- script: dotnet pack --no-build --configuration $(buildConfiguration) --output $(Build.artifactStagingDirectory)/packages
displayName: 'dotnet pack $(buildConfiguration)'
condition: and(succeeded(), eq(variables.UseVersionSuffix, 'false'))
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact'
inputs:
pathtoPublish: '$(Build.artifactStagingDirectory)/packages'
artifactName: ${{ parameters.artifactName }}