-
-
Save cashewshideout/4d8dba92fcfbb4c3fa8a3d9b409cca31 to your computer and use it in GitHub Desktop.
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
#Trigger builds only on the master branch | |
#Add additional options for more branches to target | |
trigger: | |
- master | |
#Run build for all Pull Requests targetting master branch | |
#Add additional options for more branches to target | |
pr: | |
- master | |
#Create a unique name for the build based on your project requirements | |
#BuildID is the unique ID for the build | |
name: $(Year:yy).$(Month).$(DayOfMonth).$(BuildID)-$(SourceBranchName) | |
variables: | |
AgentImage: "windows-latest" #See available agent images: https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops#use-a-microsoft-hosted-agent | |
system.debug: true #Setting debug to true will add extra output to the logs but can be useful while trying to determine full reason for failures | |
BuildConfiguration: 'Release' | |
stages: | |
- stage: 'Build_Stage' #Stage name cannot have spaces | |
displayName: 'Build' #Name displayed when viewing in Azure DevOps | |
jobs: | |
- job: 'Build_Job' #Job name cannot have spaces | |
displayName: 'Application Build' #Name displayed when viewing in Azure DevOps | |
pool: | |
vmImage: $(AgentImage) #See available agent images: https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops#use-a-microsoft-hosted-agent | |
steps: | |
- task: DotNetCoreInstaller@1 | |
displayName: 'Use DotNet Core SDK' | |
inputs: | |
version: 3.x | |
- task: DotNetCoreCLI@2 | |
displayName: Publish App | |
inputs: | |
command: publish #The publish command does a restore, build and creates a zip file so no need to add extra steps | |
publishWebProjects: true | |
zipAfterPublish: false | |
projects: '**/BasicCoreApp/*.csproj' | |
arguments: '--configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory)/application' | |
- task: DotNetCoreCLI@2 | |
displayName: Test | |
inputs: | |
command: test #Don't forget to test! | |
projects: '**/*.Tests.csproj' | |
arguments: '--configuration $(BuildConfiguration)' | |
- task: ArchiveFiles@2 | |
displayName: 'Archive build' | |
inputs: | |
rootFolderOrFile: '$(build.artifactstagingdirectory)/application' | |
includeRootFolder: false | |
archiveFile: '$(build.artifactstagingdirectory)/app/application.zip' | |
- task: PublishBuildArtifacts@1 | |
displayName: 'Publish Artifact' | |
inputs: | |
pathtoPublish: '$(build.artifactstagingdirectory)\app\application.zip' #Publish (different from the command used above) allows the artifact to be used in later jobs | |
artifactName: 'app' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment