Repository with Azure Pipelines setup example
The artifact produced is placed into
myArtifacts
directory.
Steps at a glance:
# 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:
- master
pool:
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
AzureSubscriptionServiceConnectionName: 'CHANGEME'
AzureResourceGroup: 'CHANGEME'
AzureWebAppServiceName: 'CHANGEME'
stages:
stage: MyPipeline
jobs:
- job: BuildApp
displayName: 'Build application'
steps:
- bash: dotnet build -c $(buildConfiguration) --output artifacts/
- task: CopyFiles@2
displayName: 'Copy build artifacts to Artifacts Directory'
inputs:
SourceFolder: '$(Build.SourcesDirectory)/artifacts'
Contents: |
**/*
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
displayName: 'Publish build artifacts to central location'
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: myArtifacts
- deployment: DeployApp
dependsOn: BuildApp
environment: 'MyAppDevEnvironment'
strategy:
runOnce:
deploy:
steps:
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'myArtifacts'
downloadPath: '$(System.ArtifactsDirectory)'
- task: AzureRMWebAppDeployment@4
displayName: Azure App Service Deploy
inputs:
appType: webApp
ConnectedServiceName: $(AzureSubscriptionServiceConnectionName)
ResourceGroupName: $(AzureResourceGroup)
WebAppName: $(AzureWebAppServiceName)
Package: '$(System.ArtifactsDirectory)/myArtifacts'
Next step is attaching the created artifact in the Build
stage to Releases
pipeline.
Below is an example release stage configuration, deploying to Pivotal Platform:
The screenshot assumes you’ve placed your artifacts into
drop
directory in the PublishBuildArtifacts step