Skip to content

Instantly share code, notes, and snippets.

@hibri
Created January 19, 2021 11:45
Show Gist options
  • Save hibri/06e6783f0b5e48428fd969dcb0266bc0 to your computer and use it in GitHub Desktop.
Save hibri/06e6783f0b5e48428fd969dcb0266bc0 to your computer and use it in GitHub Desktop.
# .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:
- main
variables:
- group: pie-api
resources:
pipelines:
- pipeline: functionapp
project: cherrypie
source: functionapp
trigger:
branches:
include:
- master
stages:
- stage: Build
displayName: Build stage
jobs:
- job: Build
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: 'build'
arguments: --output $(System.DefaultWorkingDirectory)/publish_output --configuration Release
- task: VSTest@2
displayName: 'Unit Tests'
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
**\*.Unit.Tests.dll
!**\*TestAdapter.dll
searchFolder: '$(System.DefaultWorkingDirectory)/publish_output'
pathtoCustomTestAdapters: '$(System.DefaultWorkingDirectory)/publish_output'
- 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: DeployDev
displayName: Deploy to dev
dependsOn: Build
condition: succeeded()
jobs:
- deployment: DeployDev
displayName: Deploy to dev
environment: 'development'
pool:
vmImage: $(vmImageName)
strategy:
runOnce:
deploy:
steps:
- task: AzureFunctionApp@1
displayName: 'Azure functions app deploy'
inputs:
azureSubscription: '$(azureSubscriptionDev)'
appType: functionApp
appName: $(devFunctionAppName)
package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'
- stage: DeployProd
displayName: Deploy to prod
dependsOn: DeployDev
condition: succeeded()
jobs:
- deployment: DeployProd
displayName: Deploy to prod
environment: 'Production'
pool:
vmImage: $(vmImageName)
strategy:
runOnce:
deploy:
steps:
- task: AzureFunctionApp@1
displayName: 'Azure functions app deploy'
inputs:
azureSubscription: '$(azureSubscriptionProd)'
appType: functionApp
appName: $(prdFunctionAppName)
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