-
Notifications
You must be signed in to change notification settings - Fork 23
/
azure-pipelines.yml
132 lines (117 loc) · 3.79 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
pr:
- master
trigger:
branches:
include:
- master
- refs/tags/v*
pool:
name: Azure-IoT-EdgeExperience-1ES-Hosted-Linux
demands:
- ImageOverride -equals MMSUbuntu18.04TLS
steps:
- task: UseDotNet@2
displayName: 'Install .NET 8 SDK'
inputs:
version: 8.x
- task: UseDotNet@2
displayName: 'Install .NET 6 SDK'
inputs:
version: 6.x
- task: NuGetToolInstaller@1
inputs:
versionSpec:
- task: DotNetCoreCLI@2
inputs:
command: 'test'
projects: 'Test/Test.csproj'
- task: NuGetCommand@2
inputs:
command: 'pack'
packagesToPack: 'Microsoft.Azure.IoT.Edge.Module.nuspec'
packDestination: '$(Build.ArtifactStagingDirectory)'
versioningScheme: 'off'
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: 'SBOM Generation Task'
inputs:
BuildDropPath: '$(Build.ArtifactStagingDirectory)'
- task: Bash@3
inputs:
targetType: 'inline'
script: |
if [[ $(Build.SourceBranch) =~ ^refs/tags/v?[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "##vso[task.setvariable variable=NUGET_PUBLISH_FLAG;]true"
fi
- task: UseDotNet@2
displayName: 'Install .NET 2.1 SDK'
inputs:
version: '2.1.x'
- task: EsrpCodeSigning@3
inputs:
ConnectedServiceName: 'template-aziotedge-pmc-v4-prod'
FolderPath: '$(Build.ArtifactStagingDirectory)'
Pattern: '*.nupkg'
signConfigType: 'inlineSignParams'
inlineOperation: |
[
{
"keyCode": "CP-401405",
"operationSetCode": "NuGetSign",
"parameters": [ ],
"toolName": "sign",
"toolVersion": "1.0"
},
{
"keyCode": "CP-401405",
"operationSetCode": "NuGetVerify",
"parameters": [ ],
"toolName": "sign",
"toolVersion": "1.0"
}
]
SessionTimeout: '20'
MaxConcurrency: '50'
MaxRetryAttempts: '5'
- task: PowerShell@2
condition: and(succeeded(), eq(variables['NUGET_PUBLISH_FLAG'], 'true'))
inputs:
targetType: 'inline'
script: |
$PACKAGEVERSION = $([xml]$(Get-Content Microsoft.Azure.IoT.Edge.Module.nuspec) | ForEach-Object package).metadata.version;
Write-Host "##vso[task.setvariable variable=PACKAGEVERSION;]$PACKAGEVERSION"
pwsh: true
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
- task: GitHubRelease@0
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
inputs:
gitHubConnection: 'github.com_marianan'
repositoryName: '$(Build.Repository.Name)'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'manual'
tag: '$(Build.SourceBranch)'
releaseNotesSource: 'input'
assets: '$(Build.ArtifactStagingDirectory)/*.nupkg'
isPreRelease: true
addChangeLog: false
- task: Bash@3
condition: and(succeeded(), eq(variables['NUGET_PUBLISH_FLAG'], 'true'))
inputs:
targetType: 'inline'
script: |
wget https://aka.ms/downloadazcopy-v10-linux
tar -xvf downloadazcopy-v10-linux
sudo cp ./azcopy_linux_amd64_*/azcopy /usr/bin/
- task: Bash@3
displayName: 'Upload to Blob'
condition: and(succeeded(), eq(variables['NUGET_PUBLISH_FLAG'], 'true'))
inputs:
targetType: 'inline'
script: |
export AZCOPY_SPA_CLIENT_SECRET=$(AZURESDKPARTNERDROPS-SERVICE-PRINCIPAL-KEY)
azcopy login --service-principal --application-id $(APPID)
azcopy copy "$(Build.ArtifactStagingDirectory)/Microsoft.Azure.IoT.Edge.Module.$(PACKAGEVERSION).nupkg" "https://azuresdkpartnerdrops.blob.core.windows.net/drops/azure-iot-edge-tools-templates-module/dotnet/$(PACKAGEVERSION)/Microsoft.Azure.IoT.Edge.Module.$(PACKAGEVERSION).nupkg"