Add publish parameter to build template (#438)

Add option to disable publishing artifacts
This commit is contained in:
John Schmeichel 2023-07-19 08:46:10 -07:00 коммит произвёл GitHub
Родитель b8b8facc72
Коммит ce5571bbed
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 17 добавлений и 13 удалений

Просмотреть файл

@ -1,5 +1,6 @@
parameters:
sign: false
publish: true
nuspecProperties: ''
steps:
@ -209,11 +210,12 @@ steps:
ARTIFACTSERVICES_SYMBOL_ACCOUNTNAME: 'microsoft'
ARTIFACTSERVICES_SYMBOL_USEAAD: 'false'
- task: PublishPipelineArtifact@1
displayName: 'Upload symbols'
inputs:
artifact: "Symbols"
targetPath: '$(Build.ArtifactStagingDirectory)\symbols'
- ${{ if eq(parameters.publish, '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
@ -221,9 +223,10 @@ steps:
- 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')
- ${{ if eq(parameters.publish, 'true') }}:
- 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'
@ -231,8 +234,9 @@ steps:
BuildDropPath: '$(Build.ArtifactStagingDirectory)\$(BuildConfiguration)\'
Verbosity: Verbose
- task: PublishBuildArtifacts@1
displayName: Publish Artifact $(Build.BuildNumber)
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\$(BuildConfiguration)\'
ArtifactName: '$(Build.BuildNumber)'
- ${{ if eq(parameters.publish, 'true') }}:
- task: PublishBuildArtifacts@1
displayName: Publish Artifact $(Build.BuildNumber)
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\$(BuildConfiguration)\'
ArtifactName: '$(Build.BuildNumber)'