Last active
June 2, 2020 13:26
-
-
Save rithala/ed2727f4faeddfa8c3caa5af5ec6ceaa to your computer and use it in GitHub Desktop.
Azure Function Azure DevOps pipeline
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
# .NET Core Function App to Windows on Azure | |
# Build a .NET Core function app and deploy it to Azure as a Windows function App. | |
# Add steps that analyze code, save build artifacts, deploy, and more: | |
# https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/dotnet-core | |
trigger: | |
branches: | |
include: | |
- master | |
- develop | |
paths: | |
include: | |
- src/* | |
exclude: | |
- src/SPA/* | |
variables: | |
# Azure Resource Manager connection created during pipeline creation | |
azureSubscription: '<guid>' | |
# Function app name | |
functionAppName: 'app-name-fa' | |
# Agent VM image name | |
vmImageName: 'vs2017-win2016' | |
# Working Directory | |
projectPath: 'src/API/CompanyName.ProjectName/CompanyName.ProjectName.csproj' | |
#VSTS Feed use with Azure DevOps Artifacts - if using Enterprise NuGet Server | |
vstsFeed: '<guid>/<guid>' | |
stages: | |
- stage: Build | |
displayName: Build stage | |
jobs: | |
- job: Build | |
displayName: Build | |
pool: | |
vmImage: $(vmImageName) | |
steps: | |
#if using Enterprise NuGet Server | |
- task: DotNetCoreCLI@2 | |
displayName: Restore | |
inputs: | |
command: 'restore' | |
projects: '$(projectPath)' | |
feedsToUse: 'select' | |
vstsFeed: '$(vstsFeed)' | |
#endif | |
- task: DotNetCoreCLI@2 | |
displayName: Build | |
inputs: | |
command: 'build' | |
projects: | | |
$(projectPath) | |
arguments: --output $(System.DefaultWorkingDirectory)/publish_output --configuration Release | |
- task: ArchiveFiles@2 | |
displayName: 'Archive files' | |
inputs: | |
rootFolderOrFile: '$(System.DefaultWorkingDirectory)/publish_output' | |
includeRootFolder: false | |
archiveType: zip | |
archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip | |
replaceExistingArchive: true | |
- publish: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip | |
artifact: drop | |
- stage: Deploy | |
displayName: Deploy stage | |
dependsOn: Build | |
condition: succeeded() | |
jobs: | |
- deployment: Deploy | |
displayName: Deploy | |
environment: 'development' | |
pool: | |
vmImage: $(vmImageName) | |
strategy: | |
runOnce: | |
deploy: | |
steps: | |
- task: AzureFunctionApp@1 | |
displayName: 'Azure functions app deploy' | |
inputs: | |
azureSubscription: '$(azureSubscription)' | |
appType: functionApp | |
appName: $(functionAppName) | |
package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment