Skip to content

Instantly share code, notes, and snippets.

@DamianEdwards
Created March 25, 2020 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DamianEdwards/a173cc518a0c31217dd1dfce205e1ce6 to your computer and use it in GitHub Desktop.
Save DamianEdwards/a173cc518a0c31217dd1dfce205e1ce6 to your computer and use it in GitHub Desktop.
.NET Core Azure stuff
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
branches:
include:
- master
paths:
include:
- src/*
pr:
branches:
include:
- master
paths:
include:
- src/*
pool:
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
rid: 'linux-x64'
projectPath: 'src/'
steps:
- task: UseDotNet@2
inputs:
version: '3.1.x'
packageType: sdk
# includePreviewVersions: true
- task: DotNetCoreCLI@2
displayName: "Restore"
inputs:
command: 'restore'
projects: '$(projectPath)/**/*.csproj'
restoreArguments: '-r $(rid) /p:Configuration="$(buildConfiguration)"'
- script: 'echo -e "\"$(Build.BuildNumber)|$(Build.BuildId)\"" > buildinfo.json'
displayName: "Emit build information"
workingDirectory: '$(Build.SourcesDirectory)/$(projectPath)'
failOnStderr: true
- task: DotNetCoreCLI@2
displayName: "Build"
inputs:
command: 'build'
projects: '$(projectPath)/**/*.csproj'
arguments: '-r $(rid) --configuration "$(buildConfiguration)" --no-restore /p:SourceRevisionId=$(Build.SourceVersion) /p:BuildNumber=$(Build.BuildNumber) /p:BuildId=$(Build.BuildId)'
- task: DotNetCoreCLI@2
displayName: "Publish"
inputs:
command: 'publish'
projects: '$(projectPath)/**/*.csproj'
publishWebProjects: true
arguments: '-r $(rid) --configuration "$(BuildConfiguration)" --no-build --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: true
- task: PublishBuildArtifacts@1
displayName: "Upload Artifacts"
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'webapp'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment