133 строки
3.8 KiB
YAML
133 строки
3.8 KiB
YAML
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"
|