Last active
June 17, 2018 20:12
-
-
Save Im5tu/3ed84e07f4db212440b56a4b84d4ad3e to your computer and use it in GitHub Desktop.
Sample VSTS YML Build Definition
This file contains 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
name: 0.1.0 | |
trigger: | |
branches: | |
include: | |
- master | |
- hotfix/* | |
- release/* | |
- feature/* | |
- bugfix/* | |
- backlog/* | |
- task/* | |
variables: | |
buildConfiguration: 'Release' | |
buildProjects: '**/*.csproj' | |
testProjects: '**/*Tests*.csproj' | |
publishProject: 'src\CHANGEME\CHANGEME.csproj' | |
dotnetCliVersion: '2.1.300' | |
steps: | |
- script: | | |
git clean -d -x -f | |
displayName: Clean Sources | |
- task: DotNetCoreInstaller@0 | |
displayName: DotNet CLI Installer | |
inputs: | |
version: $(dotnetCliVersion) | |
- task: DotNetCoreCLI@2 | |
displayName: Restore Packages | |
inputs: | |
command: restore | |
feedsToUse: config | |
nugetConfigPath: 'nuget.config' | |
projects: $(buildProjects) | |
noCache: true | |
verbosityRestore: Normal | |
- task: DotNetCoreCLI@2 | |
displayName: Build Projects | |
inputs: | |
projects: $(buildProjects) | |
packDirectory: '$(Build.ArtifactStagingDirectory)' | |
arguments: '-c $(buildConfiguration) /p:Version=$(Build.BuildNumber)' | |
- task: DotNetCoreCLI@2 | |
displayName: Test Projects | |
inputs: | |
command: test | |
projects: $(testProjects) | |
publishTestResults: true | |
arguments: '--no-build -c $(buildConfiguration)' | |
- task: DotNetCoreCLI@2 | |
displayName: Publish Web App | |
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) | |
inputs: | |
command: publish | |
projects: $(publishProject) | |
arguments: '-c Release --self-contained -r win7-x64 -o $(Build.ArtifactStagingDirectory)/drop /p:Version=$(Build.BuildNumber)' | |
- task: PublishBuildArtifacts@1 | |
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) | |
inputs: | |
pathtoPublish: '$(Build.ArtifactStagingDirectory)/drop' | |
artifactName: 'drop' | |
publishLocation: Container | |
- task: YodLabs.VariableTasks.AddTag.AddTag@0 | |
displayName: Tag VSTS Build | |
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) | |
inputs: | |
tags: | | |
Build-$(Build.BuildNumber) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment