Created
July 7, 2020 05:25
-
-
Save damiensawyer/8c7f70fc3eff720631be964d1d3bfd2e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#script | |
# https://en.wikipedia.org/wiki/YAML | |
# https://stackoverflow.com/questions/55657444/how-to-run-different-steps-in-a-yml-file-depending-on-the-branch-trigger | |
trigger: | |
batch: true | |
branches: | |
include: | |
- master | |
- develop | |
- staging | |
variables: | |
solution: '**/*.sln' | |
buildPlatform: 'Any CPU' | |
buildConfiguration: 'Release' | |
pool: | |
vmImage: 'vs2017-win2016' | |
steps: | |
# https://docs.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch#set-a-job-scoped-variable-from-a-script | |
- pwsh: | | |
If ("$(Build.SourceBranch)" -eq "refs/heads/master") { | |
Write-Host "##vso[task.setvariable variable=buildConfiguration;]www.fertilitypinpoint.com" | |
} | |
If ("$(Build.SourceBranch)" -eq "refs/heads/develop") { | |
Write-Host "##vso[task.setvariable variable=buildConfiguration;]dev.fertilitypinpoint.com" | |
} | |
If ("$(Build.SourceBranch)" -eq "refs/heads/staging") { | |
Write-Host "##vso[task.setvariable variable=buildConfiguration;]stage.fertilitypinpoint.com" | |
} | |
- script: | | |
echo building configruration $(buildConfiguration) | |
- task: NuGetToolInstaller@1 | |
- task: NuGetCommand@2 | |
inputs: | |
restoreSolution: '$(solution)' | |
- task: VSBuild@1 | |
inputs: | |
solution: '$(solution)' | |
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"' | |
platform: '$(buildPlatform)' | |
configuration: '$(buildConfiguration)' | |
clean: true | |
vsVersion: '15.0' | |
- task: PublishBuildArtifacts@1 | |
inputs: | |
PathtoPublish: '$(Build.ArtifactStagingDirectory)' | |
ArtifactName: 'drop' | |
publishLocation: 'Container' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment