-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
class-lib-package.yml
74 lines (65 loc) · 2.2 KB
/
class-lib-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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Copyright (c) .NET Foundation and Contributors
# Portions Copyright (c) Sankarsan Kampa (a.k.a. k3rn31p4nic). All rights reserved.
# See LICENSE file in the project root for full license information.
parameters:
- name: nugetPackageName
type: string
default: ''
steps:
- task: PowerShell@2
displayName: Check and fix Assembly Checksum
inputs:
targetType: 'inline'
script: |
if($null -eq $env:NF_NATIVE_ASSEMBLY_CHECKSUM)
{
Write-Host "No assembly checksum found, faking one..."
Write-Host "##vso[task.setvariable variable=NF_NATIVE_ASSEMBLY_CHECKSUM]0x00000000"
}
else
{
Write-Host "Assembly checksum found: $assemblyChecksum"
}
- task: NuGetCommand@2
condition: >-
and(
succeeded(),
eq(variables['StartReleaseCandidate'], false),
not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
)
displayName: Pack NuGet with class library
inputs:
command: 'custom'
arguments: 'pack ${{ parameters.nugetPackageName }}.nuspec -Version $(MY_NUGET_VERSION) -Symbols -SymbolPackageFormat snupkg -properties nativeVersion="$(NF_ASSEMBLY_NATIVE_VERSION)";commit="$(Build.SourceVersion)";checksum="$(NF_NATIVE_ASSEMBLY_CHECKSUM)"'
- task: CopyFiles@1
condition: >-
and(
succeeded(),
eq(variables['StartReleaseCandidate'], false),
not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
)
displayName: Collecting deployable artifacts
inputs:
sourceFolder: $(Build.SourcesDirectory)
Contents: |
*${{ parameters.nugetPackageName }}*.nupkg
*${{ parameters.nugetPackageName }}*.snupkg
TargetFolder: '$(Build.ArtifactStagingDirectory)'
flattenFolders: true
- task: PowerShell@2
condition: >-
and(
succeeded(),
eq(variables['StartReleaseCandidate'], false),
not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
)
displayName: Check deployable artifacts
inputs:
targetType: 'inline'
script: |
$artifacts = (Get-ChildItem -Path "$env:Build_ArtifactStagingDirectory" -Recurse)
if ($artifacts.Count -eq 0)
{
Write-Error "No deployable artifacts found!"
Exit 1
}