From 175ade0922b5bcb89286e680ede5fc1166c9667f Mon Sep 17 00:00:00 2001 From: ravensorb Date: Tue, 7 Jan 2020 15:57:10 -0500 Subject: [PATCH] Updated azure=pipelines.yml to support new multi-stage build/rdeployment format --- azure-pipelines.yml | 134 +++++++++++++++++++++++++------------------- 1 file changed, 75 insertions(+), 59 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5dfe840..893c0d8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,69 +1,85 @@ -# .NET Desktop -# Build and run tests for .NET Desktop or Windows classic desktop solutions. -# Add steps that publish symbols, save build artifacts, and more: -# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net - trigger: - master -pool: - vmImage: 'windows-latest' +stages: + - stage: build + jobs: + - job: Build + pool: + vmImage: 'windows-latest' -variables: - - group: Invisionware.Collections - - name: solution - value: '**/*.sln' - - name: buildPlatform - value: 'Any CPU' - - name: buildConfiguration - value: 'Release' - - name: buildTarget - value: 'Nuget-Package' + variables: + - group: Invisionware.Collections + - name: solution + value: '**/*.sln' + - name: buildPlatform + value: 'Any CPU' + - name: buildConfiguration + value: 'Release' + - name: buildTarget + value: 'Nuget-Package' + steps: + - task: NuGetToolInstaller@1 + displayName: 'Install Nuget Tools' -steps: -- task: NuGetToolInstaller@1 - displayName: 'Install Nuget Tools' + - task: NuGetCommand@2 + displayName: 'Restore nuget packages' + inputs: + restoreSolution: '$(solution)' -- task: NuGetCommand@2 - displayName: 'Restore nuget packages' - inputs: - restoreSolution: '$(solution)' + - task: replacetokens@3 + displayName: 'Transform appsetings.json' + inputs: + rootDirectory: '$(Build.SourcesDirectory)/tests' + targetFiles: '**/appSettings.json' + encoding: 'auto' + writeBOM: true + escapeType: 'json' + verbosity: 'detailed' + actionOnMissing: 'warn' + keepToken: false + tokenPrefix: '#{' + tokenSuffix: '}#' -- task: replacetokens@3 - displayName: 'Transform appsetings.json' - inputs: - rootDirectory: '$(Build.SourcesDirectory)/tests' - targetFiles: '**/appSettings.json' - encoding: 'auto' - writeBOM: true - escapeType: 'json' - verbosity: 'detailed' - actionOnMissing: 'warn' - keepToken: false - tokenPrefix: '#{' - tokenSuffix: '}#' + - task: Cake@0 + displayName: 'Build Solution: Cake' + inputs: + script: 'build.cake' + target: '$(buildTarget)' + verbosity: 'Verbose' + arguments: '-NugetArtifactsPath=$(Build.ArtifactStagingDirectory) -configuration=$(buildConfiguration)' -- task: Cake@0 - displayName: 'Build Solution: Cake' - inputs: - script: 'build.cake' - target: '$(buildTarget)' - verbosity: 'Verbose' - arguments: '-NugetArtifactsPath=$(Build.ArtifactStagingDirectory) -configuration=$(buildConfiguration)' + - task: PublishTestResults@2 + displayName: 'Unit Tests: Publish results' + enabled: true + inputs: + testResultsFormat: 'VSTest' + testResultsFiles: '$(Build.SourcesDirectory)/artifacts/tests/**/*.trx' + mergeTestResults: true + failTaskOnFailedTests: true -- task: PublishTestResults@2 - displayName: 'Unit Tests: Publish results' - enabled: true - inputs: - testResultsFormat: 'VSTest' - testResultsFiles: '$(Build.SourcesDirectory)/artifacts/tests/**/*.trx' - mergeTestResults: true - failTaskOnFailedTests: true + - task: PublishBuildArtifacts@1 + displayName: 'Publish Artifacts' + enabled: true + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)' + ArtifactName: 'drop' + publishLocation: 'Container' + + - stage: nuget_deploy + jobs: + - deployment: nuget_deploy + pool: + vmImage: 'windows-latest' + environment: nuget + strategy: + runOnce: + deploy: + steps: + - task: NuGetCommand@2 + inputs: + command: 'push' + packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg' + nuGetFeedType: 'external' + publishFeedCredentials: 'Github Connection' -- task: PublishBuildArtifacts@1 - displayName: 'Publish Artifacts' - enabled: true - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)' - ArtifactName: 'drop' - publishLocation: 'Container' \ No newline at end of file