From 4fe56e832ad2221d03272aa9a3136d8ac9aaed4c Mon Sep 17 00:00:00 2001 From: William Blum Date: Fri, 16 Aug 2019 18:11:34 -0700 Subject: [PATCH] Fix Azure pipeline conditional template --- pipeline-CI.yml | 14 ++++++++++ pipeline-signrelease.yml | 20 ++++++++++++++ ...l => pipeline-template-build-test-sign.yml | 27 ++++++++----------- 3 files changed, 45 insertions(+), 16 deletions(-) create mode 100644 pipeline-CI.yml create mode 100644 pipeline-signrelease.yml rename CI-vsts.yml => pipeline-template-build-test-sign.yml (90%) diff --git a/pipeline-CI.yml b/pipeline-CI.yml new file mode 100644 index 0000000..a6feb1b --- /dev/null +++ b/pipeline-CI.yml @@ -0,0 +1,14 @@ +# Azure DevOps Pipeline for continuous integration to build, test and package the nuget +# +# The following variables are settable at queue time. +# BuildConfiguration - Debug | Release +# NUGET_PACKAGE_VERSION - (Optional) Override the Nuget version tag that normally gets inferred from RELEASENOTES.md file + +pool: + vmImage: windows-2019 + +steps: +- template: pipeline-template-build-test-sign.yml + parameters: + SignBuild: 'false' + PublishRelease: 'false' \ No newline at end of file diff --git a/pipeline-signrelease.yml b/pipeline-signrelease.yml new file mode 100644 index 0000000..29ba2d2 --- /dev/null +++ b/pipeline-signrelease.yml @@ -0,0 +1,20 @@ +# VSTS pipeline to build, test, package, sign and release a new nuget package +# +# Requirements: define the following Azure DevOps connections +# FSharpLu-nuget - Nuget feed service connection (for pushing new packages) +# FSharpLu-Github - Github service connection (for pushing new releases) +# +# Variables overridden at queue time: +# NUGET_PACKAGE_VERSION - (Optional) Override the Nuget version tag that normally gets inferred from releasenotes.md file + +pool: + vmImage: windows-2019 + +variables: + BuildConfiguration: 'release' + +steps: +- template: pipeline-template-build-test-sign.yml + parameters: + SignBuild: true + PublishRelease: true \ No newline at end of file diff --git a/CI-vsts.yml b/pipeline-template-build-test-sign.yml similarity index 90% rename from CI-vsts.yml rename to pipeline-template-build-test-sign.yml index 4576a7f..5f9384d 100644 --- a/CI-vsts.yml +++ b/pipeline-template-build-test-sign.yml @@ -1,18 +1,14 @@ -# VSTS pipeline to build, test, package, sign and release a new nuget package -# -# Requirements: define the following Azure DevOps connections -# FSharpLu-nuget - Nuget feed service connection (for pushing new packages) -# FSharpLu-Github - Github service connection (for pushing new releases) +# The following variables are used. +# BuildConfiguration - Debug | Release +# NUGET_PACKAGE_VERSION - (Optional) Override the Nuget version tag that normally gets inferred from releasenotes.md file # -# The following variables are settable at queue time. -# BuildConfiguration -# BuildPlatform +# The following template parameters are consumed: # SignBuild - Set to 'true' if code signing is required # PublishRelease - Set to 'true' to publish a new release to Github and Nuget -# NUGET_PACKAGE_VERSION - (Optional) Override the Nuget version tag that normally gets inferred from releasenotes.md file -pool: - vmImage: windows-2019 +parameters: + SignBuild: 'false' + PublishRelease: 'false' steps: - task: DotNetCoreInstaller@0 @@ -44,7 +40,7 @@ steps: #-------------------------------------------------------------------------------------------------------------------# # Signed build # #-------------------------------------------------------------------------------------------------------------------# -- ${{ if eq(variables['SignBuild'], 'true') }}: +- ${{ if eq(parameters.SignBuild, 'true') }}: - task: DotNetCoreCLI@2 displayName: dotnet build with delaysigning inputs: @@ -89,7 +85,7 @@ steps: #-------------------------------------------------------------------------------------------------------------------# # Signed build # #-------------------------------------------------------------------------------------------------------------------# -- ${{ if eq(variables['SignBuild'], 'true') }}: +- ${{ if eq(parameters.SignBuild, 'true') }}: - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 displayName: ESRP CodeSign Nuget Package inputs: @@ -146,9 +142,8 @@ steps: #-------------------------------------------------------------------------------------------------------------------# # Signed build # #-------------------------------------------------------------------------------------------------------------------# -- ${{ if and(eq(variables['SignBuild'], 'true'), eq(variables['PublishRelease'], 'true')) }}: +- ${{ if and(eq(parameters.SignBuild, 'true'), eq(parameters.PublishRelease, 'true')) }}: - task: GitHubRelease@0 - condition: eq(variables['PublishRelease'], 'true') inputs: gitHubConnection: 'FSharpLu-Github' repositoryName: '$(Build.Repository.Name)' @@ -159,7 +154,7 @@ steps: title: 'FSharpLu Release $(NUGET_PACKAGE_VERSION)' releaseNotesSource: 'input' releaseNotes: 'Signed release $(NUGET_PACKAGE_VERSION) - + https://www.nuget.org/packages/Microsoft.FSharpLu/ https://www.nuget.org/packages/Microsoft.FSharpLu.Json/ https://www.nuget.org/packages/Microsoft.FSharpLu.Windows/'