Created
March 19, 2020 15:50
-
-
Save nikneem/3bae951615f17056dee642e745d4d1cb to your computer and use it in GitHub Desktop.
This file contains hidden or 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: | |
- master | |
variables: | |
- group: prod-variables | |
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE | |
value: true | |
stages: | |
- stage: Build | |
displayName: Build stage | |
jobs: | |
- job: Build | |
displayName: Build | |
pool: | |
name: 'Azure Pipelines' | |
vmImage: 'windows-2019' | |
steps: | |
- task: CopyFiles@2 | |
displayName: 'Publish ARM templates' | |
inputs: | |
SourceFolder: 'MyDemo.Deployments' | |
Contents: '**\*.json' | |
TargetFolder: '$(Build.ArtifactStagingDirectory)\deployments' | |
- task: DotNetCoreCLI@2 | |
displayName: 'Build Functions APP' | |
inputs: | |
command: 'build' | |
projects: '$(System.DefaultWorkingDirectory)/MyDemo.Functions/*.csproj' | |
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)\deployments' | |
displayName: 'Publish ARM Templates' | |
artifact: deployments | |
- publish: '$(Build.ArtifactStagingDirectory)\$(Build.BuildId).zip' | |
displayName: 'Publish Functions APP' | |
artifact: drop | |
- stage: Deploy | |
displayName: Deploy stage | |
jobs: | |
- deployment: Deploy | |
displayName: Deploy | |
environment: 'production' | |
pool: | |
name: 'Azure Pipelines' | |
vmImage: 'windows-2019' | |
strategy: | |
runOnce: | |
deploy: | |
steps: | |
- task: AzureResourceManagerTemplateDeployment@3 | |
displayName: 'Deploy ARM Template Incremental' | |
inputs: | |
deploymentScope: 'Resource Group' | |
azureResourceManagerConnection: '$(SERVICECONNECTION)' | |
subscriptionId: '$(AZURESUBSCRIPTIONID)' | |
action: 'Create Or Update Resource Group' | |
resourceGroupName: '$(RESOURCEGROUP)' | |
location: '$(RESOURCELOCATION)' | |
templateLocation: 'Linked artifact' | |
csmFile: '$(Pipeline.Workspace)\deployments\azuredeploy.json' | |
csmParametersFile: '$(Pipeline.Workspace)\deployments\azuredeploy.parameters.json' | |
deploymentMode: 'Incremental' | |
- task: AzureFunctionApp@1 | |
displayName: 'Deploy Functions APP' | |
inputs: | |
azureSubscription: '$(SERVICECONNECTION)' | |
appType: functionApp | |
appName: '$(FUNCTIONAPPNAME)' | |
package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip' | |
deploymentMethod: 'auto' | |
- task: AzureResourceManagerTemplateDeployment@3 | |
displayName: 'Deploy ARM Template Complete' | |
inputs: | |
deploymentScope: 'Resource Group' | |
azureResourceManagerConnection: '$(SERVICECONNECTION)' | |
subscriptionId: '$(AZURESUBSCRIPTIONID)' | |
action: 'Create Or Update Resource Group' | |
resourceGroupName: '$(RESOURCEGROUP)' | |
location: '$(RESOURCELOCATION)' | |
templateLocation: 'Linked artifact' | |
csmFile: '$(Pipeline.Workspace)\deployments\azuredeploy.json' | |
csmParametersFile: '$(Pipeline.Workspace)\deployments\azuredeploy.parameters.json' | |
deploymentMode: 'Complete' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment