artifacts-credprovider/build/build.yml

238 строки
8.9 KiB
YAML

parameters:
sign: false
nuspecProperties: ''
steps:
- task: UseDotNet@2
displayName: Install .NET Core 3.1 runtime
inputs:
packageType: runtime
version: 3.1.x
- task: UseDotNet@2
displayName: Use .NET 6 SDK
inputs:
packageType: sdk
version: 6.x
- task: NuGetToolInstaller@1
displayName: NuGet Install
- task: NuGetAuthenticate@1
displayName: NuGet Authenticate
- ${{ if eq(parameters.sign, 'true') }}:
- task: ms-vseng.MicroBuildTasks.30666190-6959-11e5-9f96-f56098202fef.MicroBuildSigningPlugin@4
displayName: Install Signing Plugin
inputs:
signType: '$(SignType)'
feedSource: 'https://pkgs.dev.azure.com/mseng/_packaging/MicroBuildToolset/nuget/v3/index.json'
- task: ms-vseng.MicroBuildTasks.32f78468-e895-4f47-962c-58a699361df8.MicroBuildSwixPlugin@4
displayName: Install Swix Plugin
inputs:
feedSource: 'https://pkgs.dev.azure.com/mseng/_packaging/MicroBuildToolset/nuget/v3/index.json'
- script: nuget restore packages.config -PackagesDirectory packages
displayName: NuGet restore
workingDirectory: CredentialProvider.Microsoft.VSIX
- script: dotnet restore
displayName: dotnet restore MicrosoftCredentialProvider.sln
- task: MSBuild@1
displayName: Build CredentialProvider
inputs:
solution: 'MicrosoftCredentialProvider.sln'
configuration: '$(BuildConfiguration)'
msbuildArguments: '/t:rebuild /p:TreatWarningsAsErrors=true'
- ${{ if eq(parameters.sign, 'true') }}:
- task: MSBuild@1
displayName: Build swixproj
inputs:
solution: 'CredentialProvider.Microsoft.VSIX/Microsoft.CredentialProvider.swixproj'
configuration: '$(BuildConfiguration)'
msbuildArguments: '/p:OutputPath=$(Build.ArtifactStagingDirectory)\$(BuildConfiguration)\vsix\ /p:TreatWarningsAsErrors=true'
- task: MSBuild@1
displayName: Build vsmanproj
inputs:
solution: 'CredentialProvider.Microsoft.VSIX/Microsoft.CredentialProvider.vsmanproj'
configuration: '$(BuildConfiguration)'
msbuildArguments: '/p:OutputPath=$(Build.ArtifactStagingDirectory)\$(BuildConfiguration)\vsix\ /p:TreatWarningsAsErrors=true'
- task: ms-vseng.MicroBuildTasks.4305a8de-ba66-4d8b-b2d1-0dc4ecbbf5e8.MicroBuildUploadVstsDropFolder@2
displayName: Upload VSTS Drop
inputs:
DropFolder: '$(Build.ArtifactStagingDirectory)\$(BuildConfiguration)\vsix\'
DropServiceUri: https://mseng.artifacts.visualstudio.com
DropRetentionDays: 365
AccessToken: $(System.AccessToken)
- ${{ if ne(parameters.sign, 'true') }}:
- script: dotnet test MicrosoftCredentialProvider.sln --logger trx --results-directory $(Agent.TempDirectory)
displayName: dotnet test
- script: dotnet publish CredentialProvider.Microsoft/CredentialProvider.Microsoft.csproj --no-build --framework net6.0 --configuration $(BuildConfiguration)
displayName: dotnet publish net6.0
# Create .NET 6.0 release for netcore users
- task: CopyFiles@2
displayName: Copy net6.0 files into tarball
inputs:
sourceFolder: '$(Build.SourcesDirectory)\CredentialProvider.Microsoft\bin\$(BuildConfiguration)\net6.0\publish\'
contents: '**\*'
targetFolder: '$(Build.ArtifactStagingDirectory)\tarball\plugins\netcore\CredentialProvider.Microsoft\'
cleanTargetFolder: true
- task: CopyFiles@2
displayName: Copy license files into tarball
inputs:
contents: |
LICENSE
CredentialProvider.Microsoft\EULA_Microsoft Visual Studio Team Services Credential Provider.docx
CredentialProvider.Microsoft\ThirdPartyNotices.txt
targetFolder: '$(Build.ArtifactStagingDirectory)\tarball\'
flattenFolders: true
- task: ArchiveFiles@2
displayName: Create net6.0 tarball
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)\tarball\'
includeRootFolder: false
archiveType: 'tar'
tarCompression: 'gz'
archiveFile: '$(Build.ArtifactStagingDirectory)\$(BuildConfiguration)\Microsoft.Net6.NuGet.CredentialProvider.tar.gz'
replaceExistingArchive: true
- task: ArchiveFiles@2
displayName: Create net6.0 zip
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)\tarball\'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)\$(BuildConfiguration)\Microsoft.Net6.NuGet.CredentialProvider.zip'
replaceExistingArchive: true
# Clean target folder and create netcore 3.1 and netfx releases
- script: dotnet publish CredentialProvider.Microsoft/CredentialProvider.Microsoft.csproj --no-build --framework netcoreapp3.1 --configuration $(BuildConfiguration)
displayName: dotnet publish netcoreapp3.1
- task: CopyFiles@2
displayName: Copy netcore 3.1 files into tarball
inputs:
sourceFolder: '$(Build.SourcesDirectory)\CredentialProvider.Microsoft\bin\$(BuildConfiguration)\netcoreapp3.1\publish\'
contents: '**\*'
targetFolder: '$(Build.ArtifactStagingDirectory)\tarball\plugins\netcore\CredentialProvider.Microsoft\'
cleanTargetFolder: true
- task: CopyFiles@2
displayName: Copy license files into tarball
inputs:
contents: |
LICENSE
CredentialProvider.Microsoft\EULA_Microsoft Visual Studio Team Services Credential Provider.docx
CredentialProvider.Microsoft\ThirdPartyNotices.txt
targetFolder: '$(Build.ArtifactStagingDirectory)\tarball\'
flattenFolders: true
- task: ArchiveFiles@2
displayName: Create netcore 3.1 tarball
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)\tarball\'
includeRootFolder: false
archiveType: 'tar'
tarCompression: 'gz'
archiveFile: '$(Build.ArtifactStagingDirectory)\$(BuildConfiguration)\Microsoft.NetCore3.NuGet.CredentialProvider.tar.gz'
replaceExistingArchive: true
# NOTE: Changing the name of the zip will break things. Please don't do it.
- task: ArchiveFiles@2
displayName: Create netcore 3.1 zip
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)\tarball\'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)\$(BuildConfiguration)\Microsoft.NetCore3.NuGet.CredentialProvider.zip'
replaceExistingArchive: true
- task: CopyFiles@2
displayName: Copy netfx files into tarball
inputs:
sourceFolder: '$(Build.SourcesDirectory)\CredentialProvider.Microsoft\bin\$(BuildConfiguration)\net461\'
contents: '**\*'
targetFolder: '$(Build.ArtifactStagingDirectory)\tarball\plugins\netfx\CredentialProvider.Microsoft\'
- task: ArchiveFiles@2
displayName: Create netfx tarball
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)\tarball\'
includeRootFolder: false
archiveType: 'tar'
tarCompression: 'gz'
archiveFile: '$(Build.ArtifactStagingDirectory)\$(BuildConfiguration)\Microsoft.NuGet.CredentialProvider.tar.gz'
replaceExistingArchive: true
# NOTE: Changing the name of the zip will break things. Please don't do it.
- task: ArchiveFiles@2
displayName: Create zip
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)\tarball\'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)\$(BuildConfiguration)\Microsoft.NuGet.CredentialProvider.zip'
replaceExistingArchive: true
- task: CopyFiles@2
displayName: Collect symbols
inputs:
SourceFolder: '$(Build.SourcesDirectory)\CredentialProvider.Microsoft\bin\$(BuildConfiguration)'
Contents: |
**\CredentialProvider.Microsoft.dll
**\CredentialProvider.Microsoft.exe
**\CredentialProvider.Microsoft.pdb
TargetFolder: '$(Build.ArtifactStagingDirectory)\symbols'
- ${{ if eq(parameters.sign, 'true') }}:
- task: PublishSymbols@2
displayName: Publish symbols
inputs:
SymbolsFolder: '$(Build.ArtifactStagingDirectory)\symbols'
SearchPattern: '**\*.pdb'
IndexSources: false
PublishSymbols: true
SymbolServerType: TeamServices
SymbolsProduct: 'artifacts-credprovider'
env:
ArtifactServices.Symbol.AccountName: 'microsoft'
ArtifactServices.Symbol.UseAAD: 'true'
- task: PublishPipelineArtifact@1
displayName: 'Upload symbols'
inputs:
artifact: "Symbols"
targetPath: '$(Build.ArtifactStagingDirectory)\symbols'
- powershell: 'Write-Output ("##vso[task.setvariable variable=SignType;]")'
displayName: Clear SignType
- script: dotnet pack MicrosoftCredentialProvider.sln -c $(BuildConfiguration) -o $(Build.ArtifactStagingDirectory)\$(BuildConfiguration) -p:${{ parameters.nuspecProperties }}
displayName: dotnet pack
- script: dotnet nuget push $(Build.ArtifactStagingDirectory)\$(BuildConfiguration)\*.nupkg --source artifacts-credprovider --api-key az --skip-duplicate
displayName: dotnet push
condition: eq(variables['PushNupkg'], 'true')
- task: ManifestGeneratorTask@0
displayName: 'SBOM Generator'
inputs:
BuildDropPath: '$(Build.ArtifactStagingDirectory)\$(BuildConfiguration)\'
Verbosity: Verbose
- task: PublishBuildArtifacts@1
displayName: Publish Artifact $(Build.BuildNumber)
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\$(BuildConfiguration)\'
ArtifactName: '$(Build.BuildNumber)'